I am mocking GetMap requests. Scenario is that 50 users use only "database layers". Each user "sends" 8 GetMap requests every ~22s for ~300s which sums up to 5200 GetMap requests for vector data. Problem is that with these parameters I see that thread count starts to grow almost immediately and usually reaches ~2k threads. When inspecting with VisualVM I saw that 1.5k threads where BLOCKED: ~50% by org.geoserver.catalog.ResourcePool.getCacheableFeatureType(ResourcePool.java:943) and other half by org.geotools.jdbc.JDBCDataStore.getPrimaryKey(JDBCDataStore.java:1062). Thread count tends to grow when Java heap reaches max point but not always - it also grows rapidly even when heap is at ~50%.

When inspecting Tomcat logs I see:

org.geoserver.platform.ServiceException: Rendering process failed
Caused by: java.lang.RuntimeException: Unable to obtain connection: Cannot get a connection, pool error Timeout waiting for idle object

Increasing max connections from 20 to 100 in GeoServer makes threads accumulate even faster.

There are 6 CPU's and 5GB RAM 2 of which are given to GeoServer's Tomcat.

Any ideas on what is the root of such problem?

SOLUTION: DB server had not enough CPU power so sessions were waiting to be processed. Increasing CPU count from 2 to 8 seem to solve extremely high tread count issue.

  • 2
    the root of the problem is probably that you are using OracleDB. – Ian Turton Jan 23 '18 at 11:33
  • 1
    Even though you've been here for a while, you still haven't taken the Tour, which emphasizes the importance of asking one question per Question. Please Edit the question. – Vince Jan 23 '18 at 11:33
  • 2
    How many connections (sessions) does your Oracle accept and how many are used during the busy time (select username, count(*) from v$session group by username;)? Trying to increase the number of connections on GeoServer side will make the situation just worse if Oracle does not accept them. Then things go actually better if you decrease the value of max_connections. Or ask your db admin to allow more. – user30184 Jan 23 '18 at 12:06
  • I was told that there is max. of 300 DB sessions. Apparently DB server had too few CPU's. After increasing CPU count to x8 I now see ~350 Tomcat threads. I was told that momentarily there still are 30-50 DB sessions waiting for the processing time so I guess I could experiment more on GeoServer's data source connection parameters and make them lower. – user435421 Jan 23 '18 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.