I'm trying to understand how servers handle many requests when they start to run out of RAM.
Let's say you have a server with 1GB of idle RAM. Let's pretend it was bombarded with 1024 requests in 1 second and each request sent over 1MB of data. Let's pretend that the server was dumb and it didn't send a response back to the client until all tcp packets were loaded in memory, and didn't deallocate until completely responding to all requests.
Let's also pretend that there was no additional memory overhead occurred besides reading the request into memory.
At this point, the server has no free memory. What would happen if it got 1024 more requests the next second? Even if the server had finished sending everything back to the client, I would imagine that with garbage collection/deallocation of memory could take much longer than the amount of time before the next 1024 reqs come in.
Would the server just miss all the tcp packets that were hitting it on it's port? If so, would the client perceive this as network congestion or a total network failure? If they perceived it as network congestion and if some packets were going through, would the client try to resend potentially dropped packets? How would the server handle this?