joswa / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

long network latency when post data is larger than 1kb #254

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start mongoose server at any port, e.g. 8080
2. Open local Linux shell, copy code in the additional information.
3. Push enter to run.

What is the expected output? What do you see instead?
Server should receive the data in no more than 10ms, however, it cost exactly 
1000ms or 2000ms. Because it's localhost, it should not take time that long.

What version of the product are you using? On what operating system?
Mongoose 3.0 on Ubuntu 10.10.

Please provide any additional information below.
curl -d 
"testdata=abcdefghijklmnopqrstuvwxyzabcdevwxyzabcdefghijklmnopqrstuvwxyzabcdefgh
ijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij
klmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl
mnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn
opqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnop
qrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr
stuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst
uvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv
wxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx
yzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab
cdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd
efghijklmnopqrstuv&_=EOS" http://localhost:8080/

Original issue reported on code.google.com by wangx...@gmail.com on 21 May 2011 at 5:16

GoogleCodeExporter commented 9 years ago
The command in the additional information above is posting 1025-bytes data to 
localhost, if you delete just one byte in the post data(then the Content-Length 
will be 1024, exactly 1kb), you will find the server will receive the data in 
no longer than 10ms. 

Original comment by wangx...@gmail.com on 21 May 2011 at 5:20

GoogleCodeExporter commented 9 years ago
And one more additional information, I used mg_read to get the post data(issue 
167).

Original comment by wangx...@gmail.com on 21 May 2011 at 5:26

GoogleCodeExporter commented 9 years ago
freshly built server does not show any lag with the example above.
Are you using your custom app to read the data?

Original comment by valenok on 22 Jun 2011 at 11:17

GoogleCodeExporter commented 9 years ago
I'm using mg_read(conn,str,length) to read post data into str.

The post data in the test command is not long enough.
Try this one.

curl -d 
"testdata=abcdefghijklmnopqrstuvwxyzabcdstuvwxyzabcdefghijklmnopqrstuvwxyzabcdef
ghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh
ijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghij
klmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl
mnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmn
opqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnop
qrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr
stuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst
uvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv
wxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx
yzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab
cdefghijkl&_=EOS" http://localhost:8888/interp

Original comment by wangx...@gmail.com on 6 Jul 2011 at 3:09

GoogleCodeExporter commented 9 years ago
Please provide your code. It is likely that the problem is with your code, not 
Mongoose.

Original comment by valenok on 6 Jul 2011 at 9:04

GoogleCodeExporter commented 9 years ago
Here is my main.cc and Makefile.
Just make and run. When the content length is larger than 1kb, the lag will 
appear.

Original comment by wangx...@gmail.com on 6 Jul 2011 at 2:28

Attachments:

GoogleCodeExporter commented 9 years ago
Any solutions?

Original comment by wangx...@gmail.com on 30 Aug 2011 at 3:25

GoogleCodeExporter commented 9 years ago
If you're using CURL, did you set the "Expect:" header? If you didn't, it tends 
to be slow for "larger" POST requests. Not sure how large will cause the 
slowdown, though....

Original comment by chester....@gmail.com on 14 Sep 2011 at 10:11

GoogleCodeExporter commented 9 years ago
As Chester said.
Please check Expect header and send "100 Continue" if required.

Original comment by valenok on 23 Sep 2012 at 1:35

GoogleCodeExporter commented 9 years ago
Rewriting header "Expect:" to empty causes the same issue on 64KB+

Original comment by murka3...@gmail.com on 7 May 2013 at 12:16