Socket recv call freezes thread for approx. 5 second

I have a client server architecture implemented in C ++ with blocking sockets under Windows 7. Everything works well up to a certain load level. If there are several clients (for example,> 4) that receive or send megabytes of data, sometimes communication with one client freezes for about 5 seconds. In this case, all other clients work as expected.

The buffer size is 8192 bytes, and server-side registration is as follows:

TimeStamp (s.ms) - bytes received

...

1299514524.618 - 8192

1299514524.618 - 8192

1299514524.618 - 0004

1299514529.641 - 8192

1299514529.641 - 3744

1299514529.641 - 1460

1299514529.641 - 1460

1299514529.641 - 8192

...

It seems that in 5 seconds you can only read 4 bytes. In addition, I found out that the freezing time is always about 5 seconds - never 4 or less and never 6 or more ...

Any ideas?

Best wishes

Michael

+7
source share
2 answers

I had this problem in high-load situations: the last TCP data packet sometimes reached the second, since the stack is not defined by default for sorting packets, this is a disorder caused by getting a similar result to what you describe.

Decision taken: load balancing in more servers

0
source

All Articles