Re: [ljc] java concurrency in web apps

From: taulant b.
Sent on: Thursday, March 7, 2013 6:51 PM

Hi,

It all depends if your request is to fetch data from different database or services than the solution is to span multiple threads and join their results you want to reduce latency.

You can use other libraries but ensure that they are actively developed and mature to avoid bugs and time bug finding between your app and third party

Containers are used as webservers for request response actions that do not need to be standalone aps to introduce more complex architecture where not needed

It all depends what the requirement is containers just provide facility to help the developers

On Mar 7,[masked]:28 PM, "Ged Byrne" <[address removed]> wrote:
Hi Jim,

You can have Web Apps with concurrency.  You should never introduce concurrency in the code that handles the request. 

You do need a policy for dealing with the potentially long running call, but you don't want to manage that from within the request.  You want the long running activity on a separate logical process that communicates with the web server using an asynchronous mechanism such as a pushing to a queue or raising an event.

You want to avoid creating that mechanism yourself.  It's hard work.  Use an existing framework where somebody has already suffered the pain. 

Regards, 


Ged

On 7 March[masked]:36, 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.  

Regards,



Ged







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.

Regards,
Jon




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Jon Hatfield ([address removed]) from LJC - London Java Community.
To learn more about Jon Hatfield, 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]




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Ged Byrne ([address removed]) from LJC - London Java Community.
To learn more about Ged Byrne, visit his/her member profile





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Jim Collins ([address removed]) from LJC - London Java Community.
To learn more about Jim Collins, visit his/her member profile





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Ged Byrne ([address removed]) from LJC - London Java Community.
To learn more about Ged Byrne, 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 12/13 Jun 14

  • SkillsMatter

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

  • Atlassian

    See here for details - http://www.atlassian.com/

  • Packt Publishing

    A publishing company specializing on specific technologies and solutions

  • 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