Hi, Steve:

A few questions:

*  Are you creating a single database client object and using it for all 
requests on the REST port?

    That's important for connection pooling.  The database client is thread 
safe after configuration.

    For instance, in a Java servlet environment, the single database client 
would be created during
    application initialization.

*  Are you writing and reading to completion?  For instance, closing streams 
after reading the data.


Hoping that helps,


Erik Hennum


________________________________
From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] on behalf of Steve Anderson 
[steve.ander...@gmail.com]
Sent: Friday, July 01, 2016 4:09 PM
To: general@developer.marklogic.com
Subject: [MarkLogic Dev General] Sockets being left in CLOSE_WAIT under load?

I'm using version 3.0.5 of the Java API client on a Mac with Oracle's Java 
1.8.0_72 and MarkLogic 8.0-5.1.

I've noticed that my app under load (multiple requests to different end points) 
is leaving of sockets between the server and the database in the CLOSE_WAIT 
state.  Under load (thousands of document writes in multiple threads), it 
climbs and climbs and climbs, with no apparent end in sight.

If I force a cleanup via the debugger (System.gc(); System.runFinalization ();) 
the majority of the sockets close.

When I run AllCookbookExamples, and, in another terminal, running "lsof -i -n 
-P|grep _WAIT" I see the same thing; the number of sockets left open grows 
until the session ends.  It's no different with the current develop branch on 
github.

I suspect it's something I'm missing related to connection pooling, but I don't 
see any documentation on connection pooling configuration.

I know I can modify ulimit on my system, but I'm afraid it's an underlying 
issue in my code that will keep the sockets open forever and eventually cause 
network issues.

Has anyone else seen anything like this?

      Steve

_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to