addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1light-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [ljc] java concurrency in web apps

From: Jim C.
Sent on: Thursday, March 7, 2013 12:22 PM
Hi Ion,

I can appreciate that could cause problems with a load balancer and ultimately the web layer is not the best place to run compute expensive long running tasks. Although it is a while since I looked at the specs I never saw anything that said you should not create new threads in a web app though. 



On 7 March[masked]:07, Ion Ionascu <[address removed]> wrote:
Hi Jim,

The problem is resource management. A long running job should be put in queue and it should be run based on some pre-defined rules.

For example, how do you exact for a load balancer to correctly dispatch jobs to the nodes in a cluster when it doesn't know the correct load on each of them?


On Thu, Mar 7, 2013 at 11:36 AM, Jim Collins <[address removed]> wrote:
What is so wrong with introducing concurrency in a web app? If the Servlet request has to make some potentially long running call then it makes sense to have a policy for dealing with this so subsequent requests do not block.

On 7 March[masked]:55, Ged Byrne <[address removed]> wrote:
Hi John,

You open yourself to a whole world of pain once you introduce concurrency.  If you can avoid it then you should. 

If there is an unavoidable need for concurrency then you might want to consider using Camel.  Then you are managing queues rather than threads, which is much easier.  



On Wednesday, 6 March 2013, Jon Hatfield wrote:
Hi all,

I have heard many times "do not create threads in a web app", since the container should manage them. However, the more modern APIs such as ExectorService appear to be used in web apps by some people. Can you use such java.util.concurrent classes in a wep app that requires multi-threading (e.g. due to high load), or do you forward data to a stand alone app that deals with the multi-threading? I can't find a definite answer on the internet.


Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Ion Ionascu ([address removed]) from LJC - London Java Community.
To learn more about Ion Ionascu, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]

Our Sponsors

  • Our Blog

    Read the latest news from the LJC

  • RecWorks Ltd

    Fixing Tech Recruitment using the Power of Community

  • jClarity

    Java/JVM Performance Analysis Tools & mentoring for Java related matters

  • LJC Aggrity

    Our LJC Aggrity site contains blog posts from our members

  • LJC Book Club

    Our Book club with book reviews from our members

  • Devoxx UK

    Java Community Conference in collaboration with the LJC, 8-10th June 16

  • SkillsMatter

    "Host, help organise, promote, film many of our meetings."

  • IBM

    Build Enterprise-grade apps at start-up speed.

  • New Relic

    New Relic makes sense of billions of metrics a day in real time.

  • Hazelcast

    Hazelcast is the leader in operating in-memory computing.

  • Java.Net

    We are an official Java User Group recognised by Oracle's JUG program

  • JRebel

    Free 3 month J-Rebel license.

  • O'Reilly

    40% discount on printed books and 50% on e-books.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy