Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go database concurrency #1

Open
Virtual-Machine opened this issue Mar 20, 2018 · 1 comment
Open

Go database concurrency #1

Virtual-Machine opened this issue Mar 20, 2018 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@Virtual-Machine
Copy link
Owner

T6 is currently testing 100 concurrent selects, but I want it to test 1000 concurrent selects.

I am limited based on an issue I am having with database/sql.

Currently when using either lib/PG or PGX's database/sql interface, I am unable to spawn much more than a hundred goroutines without encountering broken pipe errors.

PGX offers a native sql interface. Using this interface allows the necessary 1000 concurrent selects.

In the past I ran up on similar errors on Linux using MariaDB and go-sql-driver/mysql which also uses database/sql.

This means that either:

  • Different stacks (Linux - MariaDB - so-sql-driver/mysql) (Mac - Postgres - lib/pq and pgx) have the same issue due to similar misconfiguration. Both systems and dbs were configured to have plenty of headroom in terms of max connections but I may have overlooked another setting.

or

  • sql/database has an issue which causes broken pipe issues when concurrency reaches a certain rate. Considering that PGX's native interface is able to handle 1000s of goroutines without erroring, this seems plausible.

My next steps to investigate this will be to run these examples on a few other machines.

@Virtual-Machine Virtual-Machine added the help wanted Extra attention is needed label Mar 20, 2018
@Virtual-Machine
Copy link
Owner Author

Virtual-Machine commented Mar 20, 2018

On my Mac

Errors start at about 150-160 goroutines using lib/pq database/sql interface.
Errors start at about 130-140 goroutines using jackc/pgx database/sql interface.

using PGX's native interface I was able to use 100000 goroutines without errors, finished in 30 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant