0

I'm running a website on a VPS package on nomral Hard drive, and 3.25 GB RAM.

I created a test page and realized that by simply including an SQL command such as:

SELECT Name from table where Name IN ('$item_implode') ORDER BY FIELD (Name);

My page speed score (via Google page-speed) reduces dramatically, due to slow server response (anywhere from 400 ms to 1.5 seconds - while Google sets the bar at 200ms max)

I can upgrade my hosting package to SSD (Raid 10), with either slight RAM addition (total of 4GB) or to a higher addition (6GB ram).

Will any of these components dramatically change my server response time for such SQL queries? if so, should I go with 4GB or 6GB of Ram?

rockyraw
  • 101
  • 2
  • 2
    This question is unanswerable. Unless the answer is, Maybe. The question you should be asking is how do you figure out WHAT is taking so long. All database servers and other technology you are using give performance metrics you can analyze. If your analysis shows a memory bottle neck, add memory. If it shows a disk bottleneck, add disk. CPU bottleneck? You got it, boost the CPU. – Appleoddity Apr 23 '18 at 00:21

1 Answers1

1

We do not know. Only you can test the performance in your environment.


You can adjust long_query_time just above your response time threshold and get a log of everything slow. However it takes a DBA to know how to optimize, such as when to index tables, LIMIT queries, or get faster storage.


Although really you want to skip the database layer where possible.

  • Static pages for your home page and other first impression URLs.
  • Proxy caching: have a tier that caches entire pages (Varnish, Squid, nginx)
  • Fragment caching: stash pre-rendered content in your favorite very simple very fast database (Redis, Memcached)

Don't forget that performance is a feature, and it is not easy to maintain. Have your web team check out the YSlow checklist and similar to optimize.

Finally, for some inspiration have a look at actual architectures for fast sites, such as Stack Overflow: The Architecture - 2016 Edition. You will not be nearly as big or complex, but understanding a multiple-tier architecture with different databases will be educational.

John Mahowald
  • 32,050
  • 2
  • 19
  • 34