jjenkov / java-nio-server

A Java NIO Server using non-blocking IO all the way through.
Apache License 2.0
925 stars 460 forks source link

client socket time out #1

Open whutjs opened 8 years ago

whutjs commented 8 years ago

Hi, jjenkov, I really appreciate you blog because I've learned how to use Java NIO.And I have written a Http server based on your code.It works well when there are not much connections.But when I test it with high concurrent connection(10K connection), almost all the connections are time out(Socket time out). I just don't know how to optimize it now. Could you give me some advice? Thanks anyway!

jjenkov commented 8 years ago

Hi,

I cannot help you with that just yet. I will need to look into all that myself (with another protocol than HTTP) next month. Maybe I can get back to you by then. I know it's a long time to wait, but hey, at least I am getting to it.

Oh, and if you find a solution before then, please let me know!

On Fri, Nov 20, 2015 at 1:46 PM, whutjs notifications@github.com wrote:

Hi, jjenkov, I really appreciate you blog because I've learned how to use Java NIO.And I have written a Http server based on your code.It works well when there are not much connections.But when I test it with high concurrent connection(10K connection), almost all the connections are time out(Socket time out). I just don't know how to optimize it now. Could you give me some advice? Thanks anyway!

— Reply to this email directly or view it on GitHub https://github.com/jjenkov/java-nio-server/issues/1.

Jakob Jenkov jakob@jenkov.com Founder, CEO

Jenkov Aps http://jenkov.com http://tutorials.jenkov.com

http://feeds2.feedburner.com/jenkov-com

whutjs commented 8 years ago
    Alright.Thank you anyway:-)
        在2015年11月20日 20:52,Jakob Jenkov 写道:Hi,

I cannot help you with that just yet. I will need to look into all that myself (with another protocol than HTTP) next month. Maybe I can get back to you by then. I know it's a long time to wait, but hey, at least I am getting to it.

Oh, and if you find a solution before then, please let me know!

On Fri, Nov 20, 2015 at 1:46 PM, whutjs notifications@github.com wrote:

Hi, jjenkov, I really appreciate you blog because I've learned how to use Java NIO.And I have written a Http server based on your code.It works well when there are not much connections.But when I test it with high concurrent connection(10K connection), almost all the connections are time out(Socket time out). I just don't know how to optimize it now. Could you give me some advice? Thanks anyway!

— Reply to this email directly or view it on GitHub https://github.com/jjenkov/java-nio-server/issues/1.

Jakob Jenkov jakob@jenkov.com Founder, CEO

Jenkov Aps http://jenkov.com http://tutorials.jenkov.com

http://feeds2.feedburner.com/jenkov-com

—Reply to this email directly or view it on GitHub.

zalavaari commented 8 years ago

I'm still studying the sources, but I have a guess: When HttpMessageReader.read() calls Message.writeToMessage(), and there is no space for the new content, and no free block to expand, then the content of the ByteBuffer will be lost. (just a guess, didn't tried)