java - Testing Throughput of postgres database using thread pool and connection pool. But why do I only have 300 inserts per second when it should be 6000? -
i want test throughput of system has connection postgresql database. system consists of 2 main components: threadpoolexecutor newfixedthreadpool maximum of 10 threads , pgpoolingdatasource called connectionpool has maximum of 10 connections database. call stored procedures in postgres database, stored procedure simple insert , returns error message if insert failed. executing single call of stored procedure takes 20-30 ms. the system works this: main thread creates message tasks , passes them thread pool. message task following: gets connection connection pool , calls stored procedure on postgres server. waits response , task finished. thread in thread pool can work on new message task. now, think should work fine , extent. slow , have absolutely no idea why. using following code record 300-500 inserts second when should 6000 inserts per second. have no idea why. when using systems monitor, see cpus @ 20% load. when uncomment section indicated (1), 1 cpu @ 100% load while othe...