Site tactics: the question of how many SQL queries are enough

Recently, I began to open and slowly dig up a home-made CMS. The site allows you to customize a lot with the movement towards internationalization and tuning to a level that does not require source code. This is a personal project, and the whole goal was to see how far I can advance my own programming restrictions (the question of distributing the CMS that handles the blog, the web commit and the small forum is not one that I’m ready to consider that until I clean it and work on it, and also, seeing that this is an amateur project, I doubt that it is serious compared to other, more advanced projects ... but these are not topics that touch at hand.)

I created a series of code that allows me to see how quickly each page is generated and how many requests are being executed; on average, I see 9-13, up to 12 MySQL queries executed on the page. The average time to create a page is 10 to 20 ms. Now that I have no experience with professional design, what should I strive for?

What are the ways to reduce the generation time (or, on average, 15 ms / page, this is not even a problem) or the tactics of reducing the number of queries on the page where most of the FROM content of the MySQL database is loaded, including such items as menu items.

Remember, this is a very broad question; I do not intend to ask a general question or a spark of conversation, but to find out ways to reduce the load (if any) on the server that such a system can create.

+3
3
  • PHP- , PHP-, -.

  • MySQL - , , ( ) .

  • , , , . , .

  • , , XDebug. , KCacheGrind WinCacheGrind, , , . -, . , * CacheGrind .

PHP ( 8 , ). , - , 500 . , , , , , 500 .

+2

, (.. Digg/Facebook/etc), 15 .

, 12 ? , , . / , , , , ( ), .

0

... , , .

, 15 , , , . yahoo . , .

On the server, there is a possibility that db will cache the results for almost all, if not all the queries that you execute, therefore, very fast page synchronization. You might want to download a large dataset, if you have not done so already to test the application, you may find that performance degrades with the size of the dataset.

0
source

Source: https://habr.com/ru/post/1709158/


All Articles