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

workload: add idle-conns flag for adding idle connections to tpcc #62740

Merged

Conversation

RichardJCai
Copy link
Contributor

@RichardJCai RichardJCai commented Mar 29, 2021

workload: add idle-conns flag for adding idle connections to tpcc

Release note: None

#62526

@RichardJCai RichardJCai requested a review from rafiss March 29, 2021 19:12
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@RichardJCai
Copy link
Contributor Author

RichardJCai commented Mar 29, 2021

@rafiss

Did some manual testing with the flag on a local setup. Do we actually want to add some configurations to roachtest?

Also there is a flag for configuring number of connections conns which is active connections so I didn't change that. We can add a flag for number of conns per pool but not sure if that's valuable right now.

These examples only show a loose correlation between latencies increasing and idle conns. I want to do more testing with diff configurations.

idle_0.txt
idle_10.txt
idle_100.txt
idle_1000.txt
idle_10000.txt

@RichardJCai RichardJCai force-pushed the idle_connections_tpcc_03292021 branch 2 times, most recently from 3551f19 to b7f5ab3 Compare March 30, 2021 00:47
@RichardJCai RichardJCai requested a review from a team March 30, 2021 14:39
@RichardJCai RichardJCai force-pushed the idle_connections_tpcc_03292021 branch from b7f5ab3 to 86fb915 Compare March 30, 2021 14:58
@RichardJCai
Copy link
Contributor Author

Ran more tests with idle conns, tpcc for 300s on 3 node roachprod cluster, don't see a trend for latencies and idle conns.

idle_0.txt
idle_10.txt
idle_100.txt
idle_1000.txt
idle_5000.txt

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @RichardJCai)


pkg/workload/tpcc/tpcc.go, line 681 at r1 (raw file):

	fmt.Printf("Initializing %d idle connections...\n", w.idleConns)
	var conns []*pgxv4.Conn

any reason to use pgx/v4 just for this part? i think it'd be better to use the same version everywhere in the same package


pkg/workload/tpcc/tpcc.go, line 682 at r1 (raw file):

	fmt.Printf("Initializing %d idle connections...\n", w.idleConns)
	var conns []*pgxv4.Conn
	for i := 0; i < w.idleConns; i++ {

ah interesting. this seems like a good knob to have!

i didn't quite have this mind -- i was imagining that we would want more/better configuration for the MultiConnPool that is set up above (lines 620-630).

i thought the place to start would be to make MaxConnsPerPool not be hardcoded to 50. hmm but reading how pg_helpers.NewMultiConnPool works, maybe that setting isn't so relevant. we already have configuration for MaxTotalConnections which is more relevant for determining pool size (and influence the number of idle connections)

i think the issue here is that the pgxpool isn't that configurable. turns out all the interesting options (like MaxConnLifetime and MaxConnIdleTime) are only in v4... https://pkg.go.dev/github.com/jackc/pgx/v4/pgxpool

do you have an idea of how complicated it would be to upgrade this code to use pgx/v4 everywhere?

@RichardJCai RichardJCai force-pushed the idle_connections_tpcc_03292021 branch from 86fb915 to 29d88b5 Compare March 31, 2021 01:29
Copy link
Contributor Author

@RichardJCai RichardJCai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)


pkg/workload/tpcc/tpcc.go, line 681 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

any reason to use pgx/v4 just for this part? i think it'd be better to use the same version everywhere in the same package

Yeah going to use the same version.


pkg/workload/tpcc/tpcc.go, line 682 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

ah interesting. this seems like a good knob to have!

i didn't quite have this mind -- i was imagining that we would want more/better configuration for the MultiConnPool that is set up above (lines 620-630).

i thought the place to start would be to make MaxConnsPerPool not be hardcoded to 50. hmm but reading how pg_helpers.NewMultiConnPool works, maybe that setting isn't so relevant. we already have configuration for MaxTotalConnections which is more relevant for determining pool size (and influence the number of idle connections)

i think the issue here is that the pgxpool isn't that configurable. turns out all the interesting options (like MaxConnLifetime and MaxConnIdleTime) are only in v4... https://pkg.go.dev/github.com/jackc/pgx/v4/pgxpool

do you have an idea of how complicated it would be to upgrade this code to use pgx/v4 everywhere?

It would be a fair bit of manual work to upgrade it to pgx/v4, we have to update MultiConnPool in pgx_helpers.go to pgx/v4 as well which has a lot of uses. We would have to completely rework MultiConnPool since it has a pgx.ConnPool which from what I've seen, pgx/v4 does not actually have, decent amount of plumbing to replace it but I'll make an issue for it.

@RichardJCai RichardJCai force-pushed the idle_connections_tpcc_03292021 branch from ddd4cf1 to fbb2898 Compare March 31, 2021 15:36
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! hopefully either you or i can get to that followup issue later after the first batch of work is done

Reviewed 2 of 2 files at r2.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)

@RichardJCai
Copy link
Contributor Author

lgtm! hopefully either you or i can get to that followup issue later after the first batch of work is done

Reviewed 2 of 2 files at r2.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)

Yep my plan is to tackle in during flex week.

@RichardJCai
Copy link
Contributor Author

TFTR bors r=rafiss

@RichardJCai
Copy link
Contributor Author

bors r=rafiss

@craig
Copy link
Contributor

craig bot commented Mar 31, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Mar 31, 2021

Build failed:

@RichardJCai
Copy link
Contributor Author

I think it flaked, will try again
bors r=rafiss

@craig craig bot merged commit 36f99c3 into cockroachdb:master Mar 31, 2021
@craig
Copy link
Contributor

craig bot commented Mar 31, 2021

Build succeeded:

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

Successfully merging this pull request may close these issues.

3 participants