What is single thread model and multi thread model in servlet?

Container create one or more servlet instance depending on which servlet model you are using.
There are two servlet model:
  • Single Thread Model
  • Multi Thread Model
Single Thread Model:
To follow single Thread model your servlet class has to implement interface called SingleThreadModel.It is a marker interface.
In the case of single Thread Model servlet instance will be created for every incoming request that is multiple servlet instance will be created for Single Thread Model.
It is not recommendable to use SingleThreadModel because multiple instance of a servlet will not be reused. So no use of maintaining many instance for long time. This is may be cause the problem like performance & memory wastage.

Multi Thread Model
By default container follows Multi Thread Model.
Only one servlet instance will be created and the same instance will be used to provide the service to every incoming service.
It is always recommended. 

8 comments :

  1. Nice Article ... Please explain it in details if possible. And plz give example of how to implement single thread model and multi thread model.

    ReplyDelete
  2. Howdy, would you mind letting me know which web host you’re utilizing? I’ve loaded your blog in 3 completely different web browsers, and I must say this blog loads a lot quicker than most. Can you suggest a good internet hosting provider at a reasonable price?
    Best AWS Amazon Web Services Training in Chennai | Best AWS Training and Certification for Solution Architect in Chennai
    Amazon Web Services Training in Tambaram, Chennai|Best AWS Training in Tambaram, Chennai

    ReplyDelete
  3. Nice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offer such a helpful information here.
    python course institute in bangalore
    python Course in bangalore
    python training institute in bangalore

    ReplyDelete
  4. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

    rpa training in chennai
    Best rpa training in bangalore
    rpa course in bangalore
    rpa training in marathahalli
    rpa training in btm
    best rpa training in chennai

    ReplyDelete
  5. Really you have done great job,There are may person searching about that now they will find enough resources by your post
    Best Devops online Training
    Online DevOps Certification Course - Gangboard

    ReplyDelete

  6. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
    Devops Training in bangalore
    Digital Marketing Training in bangalore
    Data Science Training in bangalore
    Java Training in bangalore

    ReplyDelete