This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
See welcome thread
Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Do ServletOutputStreams block until client has acknowledged receipt?  RSS feed

Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am developing a web-server that allows a client app to download files from the server. I have this working correctly using ServletOutputStream to write the files back to the client.

When using our Java Test Harness and various web-browsers to download the files the performance for a 1.4 meg file is around 2 seconds. However the .NET client (witten by another software company) to do the same thing takes ages to download the file.

I have tracked the performance issue down to the ServletOutputStream.write() method calls - where I am writing 8kb blocks in each time. My question is - how does the ServletOutputStream work? - if the .NET client takes ages to process a given block of bytes, will the ServletOutputStream.write() method call not return (or block), until the bytes have been acknowledged?

Once I know for sure about this, I can then confidentally raise it with the Project Manager as being an issue with the other vendor's .NET code, and not our fault.

Additionally, I am using buffered readers for input, and am writing the entire buffer (8kb) with one write to the ServletOutputStream. 8kb is also the size of the write buffer on the HttpServletResponse. The file is being read using a buffered input reader.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!