Do you guys feel this should be submitted as a cake patch? thanks, thushara
On Mar 16, 10:21 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > we had to change the mysqlwait_timeoutto a much lower value (30s) > because we're using persistent connections to mysql and if we have a > highwait_timeoutvalue, it can exhaust the maximum connection limit > possible at our mysql server (mainly this limit is due to memory, each > connection takes up a thread that comes with memory for its stack > etc). > > so when there's high traffic to the web server which results in > persistent connections being open, we want them (connections) to > actually close, thus freeing resources at mysql server. otherwise, it > is possible that even bringing a new web server on would not help us, > as mysql server is at its maximum number of connections that don't get > released quickly (to allow for new connections being made from the new > web server). > > thanks, > thushara > > On Mar 13, 6:33 pm, jonknee <[EMAIL PROTECTED]> wrote: > > > While it's always a good idea to verify there is a db connection > > before making a query, it's odd you're getting these messages. MySQL > > defaults to await_timeoutof 8 hours. Those must be some pretty big > > images! > > > On Mar 13, 5:59 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > It might be a good idea to handle the disappearance of mysql server > > > due to itswait_timeoutbeing exceeded. It is possible for a query to > > > fail with mysql error = "Lost connection to MySQL server during query" > > > or "MySQL server has gone away" > > > > If another connection is made, and the query retired it generally > > > succeeds. > > > > We athttp://livemocha.com(weuseCake extensively and must say it is > > > very cool!) ran into this issue on our image upload code. The flow is > > > like this: > > > > 1. User uploads image. > > > 2. At the backend, we copy the file, resize it to several thumbnail > > > sizes. > > > 3. Update the user table with pointers to these thumbnail file paths. > > > > If it takes longer than mysqlwait_timeoutto get the file data, > > > resize thumbnails, the mysql update at 3) fails. > > > > It is fairly trivial to fis this in cake. This is what I did: > > > > function _execute($sql) { > > > $res = mysql_query($sql, $this->connection); > > > //re-connect and re-try the quey if connection was lost due to db > > > timeoout > > > if (!$res && (2006 == mysql_errno($this->connection) || 2013 == > > > mysql_errno($this->connection)) && $this->connect()) { > > > return mysql_query($sql, $this->connection); > > > } > > > return $res; > > > > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
