postgres-async-driver icon indicating copy to clipboard operation
postgres-async-driver copied to clipboard

Low Throughput

Open libliflin opened this issue 7 years ago • 4 comments

Hi,

I'm not sure if this is the right spot for this question. I was hoping for some sort of slack channel or gitter or something.

I created a benchmark because I thought this might cause a speed up, but to my surprise I couldn't get much performance boost. To be fair: I'm completely new to observables and undertow and postgres 😄 .

Is there any supporting evidence that this is actually faster than jdbc? or is it a per use case kind of thing?

My code is at async-postgres-benchmark and specifically QueriesAsyncPostgresqlGetHandler.

Thanks!

libliflin avatar Jul 09 '17 03:07 libliflin

There's a common misconception that async (non-blocking really) is "faster", when in reality, you'll often see slightly increased latency. Non-blocking behavior increases the amount of load an application can handle, which means it will perform better under load than the equivalent blocking program.

nilskp avatar Oct 22 '17 15:10 nilskp

I benchmarked this project before and after RxJava1 was introduced. Before it was just simple callback. The RxJava1 overhead slowed down a simple select 1 operation by 30%. Hopefully update to RxJava2 would give some of that lost performance back.

Also the official postgres jdbc driver has lots of optimizations that are not ported to this driver, most notably the support for binary encoding of values.

gmokki avatar Oct 23 '17 09:10 gmokki

IMO, it would be preferable to get rid of the RxJava dependency altogether.

EDIT: which seems to be the plan: https://github.com/alaisi/postgres-async-driver/issues/47#issuecomment-317825123

nilskp avatar Oct 23 '17 12:10 nilskp

Hi @nilskp and @gmokki

I'm not sure how my benchmark is measuring latency. I thought I understood that with async you trade off some latency for increased peak throughput. Please correct if this is false.

My question/comment was on why every measurement I tried is worse compared to the serial option. It's hard to find what exactly is gained with this project.

libliflin avatar Oct 23 '17 20:10 libliflin