-1

I have a Laravel PHP webapp that shows analytics data in Angular frontend to users. User can only show content, plots and tables. I have written 3 laravel commands that hourly download and store data into mysql db. The main components in the server are:

  • The API written in PHP with Laravel framework.
  • The angular frontend.
  • The nginx web server that serve API and Frontend.
  • The mysql DB that is used to store and retrieve data.

The application is online and works good with default php-cli/php-fpm, nginx, mysql configuration without any tune for current user load (10 user per minute).

I expecting a great user flow for a particular event next week, so I decided to increase server resources from 8GB RAM and 4 core to 32GB RAM with 8 core on SSD.

I'm quite new in server and db administration, I read that each component (php, mysql and nginx) have configurations that allows an amount of memory or a number of child process to be run.

How can I adjust configuration properties to use my server resources at best?

Thanks in advance!

1 Answers1

0

"A great number of user" is rather vague. If you mean 1K, there is no problem. If you are talking 1M, we need to look closer at what queries you will be using. For 1G, the platform (both Laravel and 8GB of RAM) is probably woefully inadequate.

Meanwhile, there is no "magic setting" to boost the performance.

I suggest you wait until you have 1K users or are having performance problems. At that point, we can possibly help with some slow queries or you can add more RAM. It is impossible to say when that threshold will be hit; it depends on your traffic.

Rick James
  • 2,558
  • Hi Rick, thanks for reply. I didn't know the number now because I'm in a marketing period and for now only 2000 users are in the waiting list for the event. I can suppose I would reach 5-10K users. The server has 32GB ram, the older was 8GB. What I tried to ask is some configs advice, for example, yesterday I read about php-fpm configuration @pm.max_children@ that is calculated by available ram / webapp memory usage. I edit configs from 5 (default) to 300. Maybe nginx and mysql has some default limits to adjust too. – Tenaciousd93 May 18 '21 at 09:03
  • @Tenaciousd93 - The "max_children" of the web server should be less than MySQL's max_connections, else you are likely to unnecessarily hit errors of "out of connections" and/or awful latency during spikes. For further performance advice on MySQL, see http://mysql.rjweb.org/doc.php/mysql_analysis – Rick James May 18 '21 at 16:05
  • @Tenaciousd93 - And... What do you mean by "event"? Will 10K users be hitting Enter simultaneously? If so, let's look at the details of that UI, thoroughly optimize it, etc. It will take time to handle 10K new connections. Some will get quick responses; some will get slow responses. Increasing "max*" settings will only make it so that most will get slow response! – Rick James May 18 '21 at 16:11
  • Hi Rick, thanks for you reply. I've adjust mysql's max_connections variable to a bigger number than php's pm.max_children, thanks for the suggestion! I will take a look to the website you link me to improve mysql configuration analysis. As I say, I don't know the exact number of users and if there will be 10K users at the same time instantly, the event start at a certain date and hour so I'm trying to configure the components to support it in the best way. The UI is displaying 1 line graph and a table in homepage, so there are 2 API call to my backend that produce 2 paginated DB query. – Tenaciousd93 May 19 '21 at 12:41