Search code examples
httptcp

Is a single HTTP operation atomic?


Is a single HTTP operation atomic? Today I have a meltdown in my brain working on some weird behaviour of my application.

For example two clients are sending a Post operation to the server listening on port 443.

Is the scenario below possible?:

  1. Client 1 sends request to the server
  2. Server receives Client 1 request
  3. Client 2 sends request to the server
  4. Server receives Client 2 request
  5. Server sends response to Client 2
  6. Server sends response to client 1
  7. Client 2 receive response
  8. Client 1 receives response

It drills down to the TCP/IP protocol I would guess.


Solution

  • Nope, not at all - it drills down to an implementation detail. HTTP operations are atomic in as far as the code processing them makes them so. TCP per se says nothing about that - so the question as is can not be answered.