File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Tomcat 6.0 / Multiple CPU processes out of order Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 6.0 / Multiple CPU processes out of order" Watch "Tomcat 6.0 / Multiple CPU processes out of order" New topic
Author

Tomcat 6.0 / Multiple CPU processes out of order

Greg Werner
Ranch Hand

Joined: May 07, 2009
Posts: 54
Hi all, I am not sure if I have the right forum but here we go. I have a j2ee web app running on Tomcat 6.0 on a 2 processor machine and I am doing several html submits in a certain sequence. Let us say I am doing 3 submits. 2 submits are done using jQuery post. The other 1 submit is done using javscript document.forms[0].submit(). On my machine, the 3 submits always occur in the proper order, regardless of whether 1 or 2 processors are used to handle this sequence.

When I go to another multi-CPU machine with Tomcat 6.0 and same app, when two processors have these submits divided between them, the 3 submits occur out of sequence. One of the processors comes in horribly late compared to the other processor which started the work. I need the second processor to begin its part earlier if two processors are to be used for this sequence.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
What exactly is "our of order"?
If these submits are all HTTP requests done by the client browser, doesn't the browser work the same every time?
Or are you referring to the order in which the responses are completed?

Bill
Greg Werner
Ranch Hand

Joined: May 07, 2009
Posts: 54
William Brogden wrote:What exactly is "our of order"?
If these submits are all HTTP requests done by the client browser, doesn't the browser work the same every time?
Or are you referring to the order in which the responses are completed?

Bill


If I have (jQuery)Post A, (jQuery)Post B, (javascript submit()) Post C performed on a single jsp, I need the order they are executed in the servlet layer to be doPost() of A doPost() of B and doPost() of C. I know they are independent threads, but I would like to somehow impose ordering for the 3 requests or force the use of a single processor for the 3 requests since I consider them a single atomic item (like I really would want the 3 requests to be a single thread). I posted here because I was thinking maybe there was some way of tinkering with the ThreadPool or something to impose ordering.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60817
    
  65

Ummm, no. You'll either need to chain them on the client, or combine them into a single request.

This waves a huge red flag. What are you really trying to accomplish?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kris Schneider
Ranch Hand

Joined: Feb 14, 2001
Posts: 71
Bear Bibeault wrote:You'll either need to chain them on the client...


Never used these, but you get the idea...

http://code.google.com/p/jquery-ajaxq/
http://www.protofunc.com/scripts/jquery/ajaxManager/
http://plugins.jquery.com/project/ajaxqueue
Greg Werner
Ranch Hand

Joined: May 07, 2009
Posts: 54
Bear Bibeault wrote:Ummm, no. You'll either need to chain them on the client, or combine them into a single request.

This waves a huge red flag. What are you really trying to accomplish?



Acutally Bear this is sort of in conjunction with another forum topic I posted in here before. The fundamental task I am trying to accomplish is passing tons and tons of data between jsp pages. I think if I set maxPostSize="0" in my Tomcat server.xml file that would do it? I was trying to come up with away of working around some kind of post length limit i was running into. I can do a single request if I can overcome the post length limit I am running across, and I think that might be why posts of a certain length I was reaching were failing. I just did not discover that feature of Tomcat until now because I am more familiar professionally with oc4j.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15964
    
  19

Both Tomcat and the popular web browsers run multiple concurrent threads, so if you want synchronicity, you'll have to explicitly enforce it on the client side. Although you're seeing this in a multi-CPU environment, even in a single-core system you have the same risk.


Customer surveys are for companies who didn't pay proper attention to begin with.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
OK, now I am curious about your working environment - what is this "post length limit" and where is it enforced?

The phrase:

passing tons and tons of data between jsp pages.


is rather alarming - are you really using JSP to process tons of data?

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat 6.0 / Multiple CPU processes out of order
 
Similar Threads
Multi-Processors Influence?
Java Multiple Threads-Multiprocessor
Using Tomcat 6 and the APR to monitor Server resources
To the author: Memory model
Criteria for adding servers in a tier