Page MenuHomePhabricator

fast-ec should use a connection pool
Open, Needs TriagePublicFeature

Description

put the pitchforks down, it's just to hand conn's off between threads

@Legoktm , via irc:

but I think you should be able to have a global pool of connections, max it at 10 (or some higher limit), with an expiry of 0 seconds, so if there's an active thread waiting for a connection, it passes it over, otherwise it ends it

Event Timeline

looks nice, but I'm handling multiple wikis, so I would need a different connection string per wiki, which means that pool code wouldn't work, right?

I guess we need a custom pool type that:

  • Loads your replica.my.cnf at startup
  • When you ask for a connection, you give it the database name, it gives you a connection
  • When returning the connection, if something is waiting for that name it can pass the connection back, otherwise terminate it?
  • Bonus points for knowing which databases are on the same server, and can be re-used by issuing a USE <database> command instead of opening a new connection.

AFAICT mysql_async's Pool doesn't mandate connections being made for a single database (we can just specify no database), it's just that we need a way to route them to specific servers

If you want to try the WikiPool type in https://gitlab.wikimedia.org/repos/mwbot-rs/toolforge/-/merge_requests/1/, it should be in a mostly working state.