Fork me on GitHub
#sql
<
2020-04-16
>
nick14:04:29

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.

nick14:04:10

: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

salokristian15:04:09

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.

emccue16:04:13

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

emccue16:04:48

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

emccue16:04:24

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

emccue16:04:39

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

👍 4
emccue16:04:33

(or using vendor/db specific extensions)

salokristian16:04:05

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

😢 4
Ludwig21:04:00

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