Fork me on GitHub
#sql
<
2021-11-23
>
jm15:11:57

hey! Do you know any libraries supporting async sql similarly to https://github.com/metosin/porsas? We are using porsas in one of our services but as it seems to be abandoned and had some issues with it decided to reevaluate our options there. I tried to find something similar but most of the libs are abandoned too, looked into walkable but it’s not async all the way (not using the async apis of the db engines). Is there something fundamentally wrong doing async sql?

Ben Sless15:12:10

What issues did you have with porsas?

jm20:12:08

They were not caused by porsas but the underlying vertx-sql-client, one of the was a bug there that on https://github.com/eclipse-vertx/vert.x/issues/3249 it tried to receive a response (although with the update client this still seems to be an issue 😕)

jm20:12:00

The other one was related to the fact that we were trying to use it with RDS autoscaling and testing showed that the newly spun up replicas didn't get any traffic. This was caused by the way how the connection pool was working, in the new version this was also improved

jm20:12:54

I fixed these issues by updating the lib in porsas https://github.com/metosin/porsas/pull/12

seancorfield18:11:00

@meszaros.jns JDBC itself is synchronous so your choice for async is: a) write a sort of fake async layer over the top of JDBC or b) use one of the experimental (and fairly volatile -- and often DB-specific) asynchronous DB drivers.

jm21:11:01

Thanks for your answer, those two options were the result of my investigation too, I was just hoping there was an option/lib I couldn't find

kulminaator19:11:32

Sql itself by design is not async

jm21:11:22

As far as I could see there are async apis on most of the major db engines. I'm mostly using postgres which definitely has one

kulminaator12:11:00

There are some apis but its still not by design

kulminaator19:11:34

You are doomed to be io bound, doing more badly performing io at a time won't make life much better

emccue19:11:32

@meszaros.jns All work on async jdbc apis has died in favor of waiting for this https://openjdk.java.net/jeps/8277131

jm21:11:17

Oh I see, makes sense

Ben Sless15:12:25

I know some adventurous individuals already use Loom in production

emccue19:11:38

do some napkin math for yourself with these variables

jm21:11:43

Thanks, definitely will do this 😊

jm21:11:26

We already has a service which is async end-to-end, but the maintaining cost still applies

emccue19:11:24

• How long will it take to initially migrate to sync apis • How long will it take to do the work to be async • How many extra hours of maintenance will your async code need • How much will the extra machines cost if you use sync code • How long do you think it will be until virtual threads reach preview (my money is on next Sept) • How much do your engineers cost per hour