Reputation: 1286
I have python web app (WSGi) which is deployed using uwsgi and nginx. I am going to provide this app to many users (customers) - each user will have his own settgins, database, templates, data folder etc. The code of the app can be shared.
My original idea was to have one uwsgi process per customer. But it is quite wasteful approach, because currently the app has about 100MB memory footprint. I expect that most of these instances will be sleeping most of the time (max 500 requests per day).
I came up with this solution:
The app will be modified in the way, that one instance may serve for more customers. Based on the requested domain, it will prepare (load) the right settings, database connection etc. for that customer.
Is this good idea? Or should I rather focus on lowering the memory footprint?
Thank you for your answers!
Upvotes: 0
Views: 379
Reputation: 42030
The app will be modified in that way, that one instance may serve for more customers. Based on requested domain, it will prepare (load) the right settings, database connection etc. for that customer.
Is this good idea?
Well, I've used a similar system in production whereby there are n
instances of the app, but each instance can serve any customer, based on the HTTP Host
header, and it works quite well.
Given a sufficiently large number of customers, it may not be cost-effective, or even practical, to have one instance per customer.
Upvotes: 1