I have a web app, having 2 tiers: wordpress as frontend and MySQL as backend.
The frontend is deployed using Helm chart, however the backend is deployed using Operator.
Since my webapp receives a lot of traffic, i would like to implement horizental pod autosacling (HPA).
My Question: Where can i define HPA: in frontend part (i.e: wordpress level) ? in backend part (i.e: MySQL level) ? or both ?
Thank you for your help!
CodePudding user response:
You probably can't usefully set up HPA on the database. MySQL and PostgreSQL are usually single nodes, or if they have multiple nodes, they run in an active/standby mode, so adding nodes won't necessarily add capacity. (Even with a clustered database, there can be practical problems with setting up HPA around scale-in.)
You can set up HPA on the application. It's helpful to understand what the limiting factor on your application actually is: if you send enough load that it starts being slow or failing requests, is it starved for CPU time, out of memory, or waiting on the database? That would affect what parameters you'd want to set on the HPA.
One realistic situation is that your application does some database queries, which take the bulk of the time, and then very quickly renders the data to HTML or JSON. In this situation it will be hard to take advantage of HPA: the single-node database is hard to scale, and even if you scale up the application pods, you'll still be blocked on database queries.