I have a third-party developed EJB application deployed on JBoss 5.1 server. I am trying to load test the application by accessing a single EJB from multiple threads from my local client.
below is the output :
logged in 1395842350839
object looked up 1395842353718
created the session1395842355107
thread number : 1 : calling the EjbMethod at 1395842355109
thread number : 2 : calling the EjbMethod at 1395842355109
thread number : 3 : calling the EjbMethod at 1395842355109
thread number : 6 : calling the EjbMethod at 1395842355110
thread number : 5 : calling the EjbMethod at 1395842355110
thread number : 7 : calling the EjbMethod at 1395842355111
thread number : 9 : calling the EjbMethod at 1395842355111
All threads started at : 1395842355111
thread number : 10 : calling the EjbMethod at 1395842355111
thread number : 4 : calling the EjbMethod at 1395842355113
thread number : 8 : calling the EjbMethod at 1395842355113
thread number : 1 : called the EjbMethod at 1395842355499
thread number : 2 : called the EjbMethod at 1395842356255
thread number : 5 : called the EjbMethod at 1395842356264
thread number : 6 : called the EjbMethod at 1395842356274
thread number : 7 : called the EjbMethod at 1395842357268
thread number : 4 : called the EjbMethod at 1395842357277
thread number : 10 : called the EjbMethod at 1395842357287
thread number : 8 : called the EjbMethod at 1395842357297
thread number : 9 : called the EjbMethod at 1395842357307
thread number : 3 : called the EjbMethod at 1395842357318
All threads finished at : 1395842357318
Below are the output times when I sequentially invoked the EJB 10 times (directly invoking 'currencydata = session.queryAllCurrencyData_6(null);' 10 times in main(). No parallel threads involved. Also only a single JNDI lookup and a single call to EjbCreate() as I used the same remoteObject for each invocation):
logged in 1395842765210
object looked up 1395842767187
created the session1395842768205
got response at : 1395842768546
got response at : 1395842768871
got response at : 1395842769192
got response at : 1395842769512
got response at : 1395842769834
got response at : 1395842770158
got response at : 1395842770479
got response at : 1395842770802
got response at : 1395842771125
got response at : 1395842771449
So as I observe the two, in sequential calls to the EJB, the response time is around 320ms every time.
So theoritically, If we invoked the same EJB 10 times in 10 parallel threads, it should take 320ms to finish all the threads, or maybe 500ms at the max.
But it is taking 1395842357318-1395842355111 = 2207ms = 2.2 seconds.
The AIX server on which the EJBs are deployed has 16 CPU cores available, 14 GB RAM.
I have checked the standardjboss.xml to have :
<MinimumSize>25</MinimumSize> <!-- I added this which improved the performance to this level-->
for Stateless Session Bean
What am I missing here? Any insights would be great.
Thanks for the reply Jaikiran.
The bean is retrieving all the data from a database table.
The bean is developed by a third party team and we do not have the source-code for it.
Joined: Jan 06, 2011
Could it be that the bean's code is taking some lock on some object before reading the table? but I don't think that they'll need to synchronize for reading a table? synchronizing for writing to a table makes more sense I guess.....