1

I have clients that need to post 30MB of xml data. The data is in binary form and is heavily encrypted. The client hit to my servlet running on tomcat, then i get the data via Servlet request.getParameter("_xmldata");

The problem is, it takes around 25seconds just to move the 30MB data to a String variable. So in my head, there are two questions:

1) Why is it the case?

2) Is there anyway i can improve this? (apart from getting the user to send via FTP / SSH)

Server Environment:-

  • CPU: Quad Core Xeon 5540
  • Server Memory: 4GB
  • Tomcat Heap: 2GB
  • Harddisk : 500GB
Reusable
  • 1,888
  • 7
  • 27
  • 46

1 Answers1

1

I'm going to wager a guess that the getParameter method is still waiting on the necessary data within the request to be received. You could confirm this by monitoring your server with something like Wireshark.

All the required HTTP request headers have already been received, which is enough for the server to start processing the request. But once you call getParameter, it is likely still waiting for the entire "field" to be received. Check the bandwidth between your client and your server. I highly doubt it's a CPU issue (nothing you'd need a quad core for).

You could somewhat confirm this by placing small test text fields both before and after the _xmldata field in the request. Read only these fields around _xmldata. I'm guessing that the attempting to read the last will also encounter about the same delay you've been observing.

(I'd also be cautious as to how you're receiving binary data through a request parameter - and furthermore, moving it into a String variable. I'm hoping it's encoded with something like Base64 encoding...)

ziesemer
  • 27,712
  • 8
  • 86
  • 94
  • 1
    Network bandwidth is what i am suspecting as well. I am running simulation test on a wireless environment very similar to our production side (g wireless network, that means a 54Mb bandwidth sharing with 15 active users). i will run the simulation code in the server itself. see if it runs faster. – Reusable Jan 19 '12 at 03:50
  • Issue found! It is definitely the network! I tested the same code on the localhost machine, the speed is 300ms. while i use a crossover cable from other server, it is only 700ms. when i test from server to server, it is only 3s. The main reason wifi to server is slow because our router is doing a logical zoning between client machine and server farm network. And the bottleneck is actually at the router. – Reusable Jan 19 '12 at 05:59