Tell me, in very busy projects, there are tables of requests for closings, or do they store only summary information?

The question arose, since the project appeared for 300-500 thousand requests per day. Server with a slow hard drive (7200). And on the table of rekvestov (InnoDb), 5-10 slow insert-ins began to appear once every 3-4 hours, for 5-30 seconds of those who are weighing. I unscrewed all that is possible in Mysql, but anyway, sometimes these inser-you pop up. In the table id is the primary key, and another index by time. MySQl version 5.6.

The table now contains 5 million records. There is an option either not to store requests at all, but leave only sessions, or use the type of Memory tables, and merge information at night.

  • For very busy projects using NoSQL database for example MongoDB - Shnur
  • For the whole project or only for rekvestov? I regularly hear that many refuse NoSQL and come back to MySQL, - yavafree
  • Well, of course, because they don’t understand how to work with him correctly ... - Shnur
  • Facebook? sort of moved ... - yavafree
  • 2
    Facebook, this is generally the most crooked social network in the world, there is even a piece of my code ... there's nothing more to say about Facebook)))) - Shnur

2 answers 2

You can take the loaded part to a separate database. Perhaps, instead of InnoDb to use MyIsam, InnoDb does not insert very quickly. I would recommend not to immediately write to the database, but to write to some queue, the same Redis or RabbitMQ, or even to the minute-by-minute log files. And already from the queue of crowns using the script, select the data and insert it into the database.

  • I tried myisam - it turned out not better, maybe even worse, since the table apparently also locks for other threads. And then one request hangs up everything. Do not want to use the queue so that the project does not lay down. - yavafree
  • I understand that the whole plug-in occurs at the time of dropping data to disk, once in how many seconds. I want to try to increase the size of innodb_log_file_size so that data reset is less frequent. - yavafree

@Mike - thanks, I decided not to write all requests. This piece dragged from the old project, then it's time to remove it.