Score:0

Apache limits errors when scalling with many domains for Saas app

al flag

**Hello everybody ,

I making SaaS app like Shopify and ecwid , user create store within 10 mins , once he register he get automatic subdomain with SSL and can add products and payment methods, categories ... etc.

We use Laravel + Mysql + Apache + Cpanel with dedicated server . We have dedicated server with (AMD Ryzen™ 7 3700X,64GB RAM) with Centos 7 + WHM/CPANEL

App now it almost done and it is in test stage . Currently user gets subdomain automatically but if user needs to add his custom domain we add this domain manually as addon domain in app cpanel account or automatically via Cpanel API . I see that when I add one addon domain Apache httpd.conf size increases every store can add up to 5 domains.

For example currently we have 20 addon domains so we httpd.conf size = 144KB if addon domains increased to 200 this means httpd.conf size will be 1440KB (1.2 MB) if addon domains increased to 2000 this means httpd.conf size will be 14400KB (14 MB) if addon domains increased to 10,000 this means httpd.conf size will be 72000KB (72 MB) this mean if we have 10k domains and 10,000 visitor at same time it will request httpd.conf which is 72 MB about 10,000 times it will make server down or very slow .

1.- Am I right with my calculations?

2.- If I decided to make load balance this will solve the problem ? (consider that httpd.conf will be have same addon domains for all server in our network )

3.- If we used Nginx this will solve the problem ?

4.- What is the best server for this type of apps (Nginx or Apache ) ?

thanks**

vidarlo avatar
ar flag
Why do you believe that Apache reads httpd.conf on each requests?
vidarlo avatar
ar flag
Does this answer your question? [Can you help me with my capacity planning?](https://serverfault.com/questions/384686/can-you-help-me-with-my-capacity-planning)
mo saleh avatar
al flag
by research i see NGinx it caches domains IN hash table in L1 ,L2 or L3 memory , but i don't know how apache works for this point what happen when we have 10k domains ?
mo saleh avatar
al flag
@vidarlo ......
Wilson Hauck avatar
jp flag
@mosaleh Maybe try Google search for 'apache tutorial' ?
vn flag
Stop adding domains to httpd.conf. Just have your server send all requests to the same application, and handle the hostname at the application level; look up the correct client for the hostname in your database.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.