Frank Poo wrote: > Marnen: here are some more details. I need to be able to handle at least > 10 API requests / second. Let met clarify what happens: > > 1) User makes a RESTful API request > 2) I find a record in a database, return it as JSON > 3) I record the request counter for the user in the database (i.e. if I > user makes 2 API calls, I record '2'). > > #1 and #2 are really fast in SQL - they are SELECTs. #3 is really slow, > because it's an UPDATE. In the real world, my database (MySQL) is NOT > scaling.
Well, there's your first problem -- you're using mySQL. :) Try PostgreSQL instead. (That was admittedly snarky. Although PostgreSQL is certainly the better choice, mySQL should still work.) > According to New Relic, #3 is taking most of the time. What does that query look like? A simple UPDATE query should not be a major performance hit, so there must be something else going on. Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" 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/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

