java - JDBC performance when connection is stablished -


i want reduce time of part of project takes 2 hrs.

how has been coded goes , take out 700,000 uid 1 table , pass 16 different threads. each thread connect jdbc , fetch row uid 1 one. runs 700,000 query! 50k each thread

because uses 3 4 fields of each row plan needed fields @ first , don't connect database anymore. concerns:

  • because fetch row uid ( assume should fast) improve performance dramatically ?
  • i need worry memory , cache misses , everything, putting 700,000 rows couple of fields in memory scares me.

overall think improve performance or think doesn't matter much. saving 5min because of testing necessary doesn't worth it.

so think should pursue path or focus more on logic???

thanks lot

as has been suggested in various comments, should load records in batches. don't know how infrastructure configured, if using cloud service, database round trip can take on order of hundreds of milliseconds.

however, may not problem. if haven't configured connection pooling, may gaining nothing multi-threading each thread waits grab database connection. pool size should take account how many connections may established concurrently (in case, sounds 17 may number - 1 main thread , 16 workers - if understand architecture correctly).


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -