Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

commit 90e4194 causes massive performance degradation #179

Open
njeuk opened this issue May 8, 2016 · 3 comments
Open

commit 90e4194 causes massive performance degradation #179

njeuk opened this issue May 8, 2016 · 3 comments

Comments

@njeuk
Copy link
Contributor

njeuk commented May 8, 2016

Hi, I'm seeing a massive performance degradation with the commit 90e4194 .
I suspect Postres handles with the numeric conversions badly -- but not really sure that is the root cause yet, or how to work around the issue.

Sample code:

object TestPerf {
  def main(args: Array[String]): Unit = {
    val configuration = URLParser.parse("jdbc:postgresql://someaddress/somedb?user=someuser&password=topsecret")
    val connection: Connection = new PostgreSQLConnection(configuration)
    Await.result(connection.connect, 50.seconds)
    val startTime = LocalDateTime.now()
    for (i <- Range(1, 1000)) {
      val id = Random.nextInt(3000000)
      Await.result(connection.sendPreparedStatement("update companies set name = name where id = ?", Array(id)), 10.seconds)
      val elapsed = java.time.Duration.between(startTime, LocalDateTime.now())
      println(s"$i : ${elapsed.toMillis / i} average mSec per update")
    }
    connection.disconnect
  }

With 90e4194 applied, I get a response like:

[info] Running com.example.TestPerf 
1 : 1611 average mSec per update
2 : 1463 average mSec per update
3 : 1526 average mSec per update
4 : 1438 average mSec per update

without:

[info] Running com.example.TestPerf 
1 : 68 average mSec per update
2 : 67 average mSec per update
3 : 61 average mSec per update
@njeuk njeuk changed the title https://github.com/mauricio/postgresql-async/commit/90e4194adb2d02b229fcccdc754513e486518bb7 for #169 causes massive performance degradation commit 90e4194 causes massive performance degradation May 8, 2016
@mauricio
Copy link
Owner

mauricio commented Jun 7, 2016

Gonna remove that and see if we can come up with a better solution.

@augi
Copy link

augi commented Jul 21, 2016

Maybe we ran into the same issue - we used 0.2.16 and when I updated it to 0.2.20 then few tests started to timeout. Downgrading to 0.2.19 didn't help, 0.2.18 works well (the mentioned commit was added to 0.2.19).

@oshai
Copy link

oshai commented Sep 17, 2018

I fixed/reverted this in jasync-sql(fork) 0.8.30: jasync-sql/jasync-sql#16 . more details in the issue: jasync-sql/jasync-sql#15

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants