jeff,
@jeff@phpc.social avatar

I'm surprised more projects aren't having this MySQL scaling issue in .

MYSQLI_OPT_CONNECT_TIMEOUT only affects the TCP init, not the time to first byte.

MYSQLI_OPT_READ_TIMEOUT is then also needed to time out quickly if a socket connects but sends no data in a reasonable time (DoS otherwise).

However, that also aborts queries that run longer than the limit (reports, schema upgrades).

You have to set the timeouts before a connection and can't use @@session.

https://bugs.php.net/bug.php?id=76703

ramsey,
@ramsey@phpc.social avatar

@jeff Maybe because more folks use PDO_MYSQL instead of mysqli?

jeff,
@jeff@phpc.social avatar

@ramsey Sure, that's possible. I'll check if PDO avoids the issue, but a glance at the docs seems like ATTR_TIMEOUT doesn't make a connection / read distinction for MySQL either.

The bug report proposes a reasonable change of including the max-time-to-first-byte in the connection timeout so connect/read are properly decoupled. RDS has had this issue a few times (probably load balancer related).

Cerb is likely older than PDO, so that's not an easy change. I'd break more than I fix. 😅

  • All
  • Subscribed
  • Moderated
  • Favorites
  • php
  • DreamBathrooms
  • magazineikmin
  • thenastyranch
  • modclub
  • everett
  • rosin
  • Youngstown
  • slotface
  • ethstaker
  • mdbf
  • kavyap
  • osvaldo12
  • InstantRegret
  • Durango
  • megavids
  • ngwrru68w68
  • tester
  • khanakhh
  • love
  • tacticalgear
  • cubers
  • GTA5RPClips
  • Leos
  • normalnudes
  • provamag3
  • cisconetworking
  • anitta
  • JUstTest
  • All magazines