Does using more servlets affect performance, etc ?????


Performance and scalability: Does using more servlets affect performance, etc ?????

  1. hi all,
           I would like to know if in a project the number of servlets written affect performance or anything similar related to efficiency etc.

    Say for a scenario like this.
    i have a project (applet servlet communication)that needs to search, advance search, print, save. (the applet has such features) for each of this i could write a servlet or write a single one that will do these say depending on a parameter sent by the applet. i think separating them would give a better abstraction.
    please tell me what is better.
    thanx in advance

  2. In your scenario, seperating the functions into different servlet is a much better idea from the design point of view. It doesn't affect the performance, although it cost you a little more memory, but that's insignificant
  3. please consider a different scenario. i have a stateless session bean containing the business methods for differernt purposes as mentioned earlier and now if i write a single servlet which invokes different business methods of the bean based on a certain condition, will this be better than the previous approach.

    thanx for u r reply
  4. Prithvi Raj wrote:

    ... will this be better than the previous approach.


    I like to make sure that my servlets don't have any business logic in them at all. You should generally think of a servlet as an 'HTTP adapter' - something that translates incoming HTTP requests into internal system requests.

    Now, whether that means that you move your business logic into SSBs or somewhere else, is up to you.

    God bless,
    -Toby Reyelts