very serious Synchronization issue....urgent

Discussions

Web tier: servlets, JSP, Web frameworks: very serious Synchronization issue....urgent

  1. very serious Synchronization issue....urgent (1 messages)

    I have just completed a big project on E-CRM, but in the end stage of our project we realized that there was flaw in our approach, which is turning out to be very dangerous. My JSPs are not threadsafe and global variables are declare in most of the jsps moreover jsps are included with global functions (within <%! %> tag). These global functions as well as service method accesses these variables.
    We deployed our application at customers site but now under heavy loads we are facing synchronization problems. Like entry of one user sometimes interchanges with the entry by other user. This happens when both the operations are done at the same time and there is heavy load on the server. This is obviously a very serious bug.
    I can follow two approaches:
    1. make all the jsps threadsafe by synchronizing the service method: but this will reduce the performance (i am using weblogic server).
    2. make all global variable declarations with in the service method and pass the same in whichever global functions it is required : but over project is a huge one (around 700 Jsps), this will involve a huge amout of changes, which we can't afford at this time.
    So, point 2 is out of question.
    Brecause this seems to be a very common problem, can somebody tell me what is the best solution to deal with this. Is there any other way other then above two points..
    This will be a very very big help to me..
    Thanks a lot in advance..
  2. if these global variables are to be accessed by multiple threads, it's absolutely necessary to make them thread-safe, even at the expense of performance hit.

    However, u can minimize the impact by avoiding unnecessary synchronization. Check out Practical Java book for tips on this.

    alex