sql

All things SQL and JDBC...
nick 2020-04-16T14:55:29.274300Z

Please fix me if I'm wrong. I'm new to clojure & jdbc connection pooling(jdbc.pool.c3p0) Trying to understand the proper config. My DB gives me 20 connections, so I set jdbc.pool.c3p0/make-datasource-spec to :initial-pool-size 19 :min-pool-size 19 :max-pool-size 19 right? All 19 connections available from the pool + one more for remote access to production(single connection, not via pool)? Let's say only one person may want to access production repl at a time.

nick 2020-04-16T14:57:10.274800Z

:min-pool-size
Minimum number of Connections a pool will maintain at any given time.

:max-pool-size
Maximum number of Connections a pool will maintain at any given time.

:initial-pool-size
Number of Connections a pool will try to acquire upon
For the reference

salokristian 2020-04-16T15:48:09.275500Z

I'm working on comparing databases with large loads (thousands of queries per second). The test code is written in Clojure, and uses next.jdbc for database access. Currently the code is single-threaded, and way too slow. As a result, I need to parallelize it. What would be the best option for parallelizing this code so that I can execute thousands of database queries per second? The code is deployed in GCP, so hardware resources are not the bottleneck. The main issue is that I'm not sure what is the best way to parallelize this type of I/O-bound workload. I have thought of a few solutions: 1. Built-in tools such as future/pmap , which would have sufficient functionality. However, they might be problematic due to the limited number of available threads (since I'm aiming for over 1000qps). 2. Some event-driven solution. However, I'm not sure if such a solution would improve performance because next.jdbc is sequential AFAIK. Maybe I should swap next.jdbc for some other tool entirely? I would greatly appreciate any directions or ideas on this problem, since I'm having a hard time understanding what type of solution would be the most suitable for this situation.

kszabo 2020-04-16T15:50:41.275900Z

one alternative: https://github.com/metosin/porsas

emccue 2020-04-16T16:05:13.276800Z

@salo.kristian Unfortunately fibers aren't here yet, so maybe starting with some connection pooling might help a bit

emccue 2020-04-16T16:05:48.277400Z

but the ideal would be some connection pooling in addition to 1 fiber per request

emccue 2020-04-16T16:06:24.278Z

you won't find any jdbc thing that isn't sequential

emccue 2020-04-16T16:06:39.278300Z

anything that claims to be is just throwing jdbc stuff on threads

👍 1
emccue 2020-04-16T16:10:33.278600Z

(or using vendor/db specific extensions)

salokristian 2020-04-16T16:43:05.282900Z

porsas does look promising, but it is unfortunately not suitable, since I need to work with several specialized databases such as InfluxDB and BigTable

😢 1
Vachi 2020-04-16T21:07:00.286400Z

@salo.kristian what about core.async and go channels?