Long wait interval between requests with a single threaded client
-----------------------------------------------------------------

         Key: DIRMINA-221
         URL: http://issues.apache.org/jira/browse/DIRMINA-221
     Project: Directory MINA
        Type: Improvement

    Reporter: Emmanuel Lecharny
    Priority: Critical


Hi MINA band,

we are currently experiencing a very strange behavior in MINA. While doing 
performances tests of ADS? we found that we cannot go upper than 25 search 
requests per second. We stripped the server from its backend, and eventually, 
Alex wrote a single client/server program unsing MINA to isolate the pb.

Vasically, we have a client which continuously send requests, and get a result 
from a very simplified server. If the client has only one thread running, there 
is a wall we hit ate around 25 req/s. If we use more than one thread, suddenly 
this wall go up to NbThreads*25 req/s (ie, with 4 threads requesting, we reach 
100 req/s, with 10, 250 req/s, ... with 100 threads, we have 1500 req/s).

After having put some traces into MINA, here what I found in BlockingQueue : 
those two methods seems to be connected. When you call notifyAdd, then the 
method waitForNewItem() wait stops. We are waiting for an average of 40ms for 
each request in the waitForNewItem() method, ad I don't know which kind of 
processing or synchronization generate those 40ms wait.

...
    private void notifyAdded()
    {
        if( waiters > 0 )
            notify();
    }
...

...
    public synchronized void waitForNewItem() throws InterruptedException
    {
        waiters++;
        try
        {
            while( super.isEmpty() )
            {
                wait();
...

Here is a sample of time wait we have in the fetchBuffer() method, which call 
the waitForNewItem() method (time is in ms) :
...
Waited : 42
fetchBuffer : 42
Waited : 0
fetchBuffer : 0
Waited : 1
fetchBuffer : 1
Waited : 39
fetchBuffer : 39
Waited : 0
fetchBuffer : 0
Waited : 1
fetchBuffer : 1
Waited : 39
fetchBuffer : 39
Waited : 0
fetchBuffer : 0
Waited : 1
fetchBuffer : 1
Waited : 39
fetchBuffer : 39
Waited : 0
fetchBuffer : 0
Waited : 1
...

I know that the wait I get the delay is not very optimal 
(System.currentTimeMillis()), but 40 ms is *very* long. 

At this point, Alex and me are clueless. We have not enough understanding on 
the Mina internals to explian and fix this problem - if it's a problem -, or to 
configure MINA to avoid this kind of behavior.

If any of you could help us, this will be *very* appreciated, as the whole LDAP 
server perfomance relies on MINA.

Thanks !

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to