Tomcat request.getParameter("_xmldata") takes 25second for 30MB data

702 views Asked by At

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
1

There are 1 answers

2
ziesemer On BEST ANSWER

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...)