Score:0

How to handle scaling upto 3k concurrent connections

np flag

So here's our use case: We have firmware that connects to server (simple php file - that takes post request) and add the data (350-500 bytes per request) to database.

Now here's a issue we have 3k units in the market and non-technical manager wants server to be able to handle 3k concurrent connections in worst case. Current it can handle around 600-650 connections (VPS 8GB NVMe - 6 core CPU (3.1 GHz) - 8GB NVMe RAM - 100GB NVMe SSD and 4TB bandwidth) costs around $100/month.

To scale up/scale out the cost is going to be enormous especially in the future when they are expecting 100k-500k units (which will again be a worst case).

Now good thing is that even if firmware fails to connect to server it can try reconnecting after 1 min/3 min and so on.. until the data is pushed - doesn't really hinders user experience at all. That's what I have been trying to convince them to do. Any other tips?

And let's say if we were to scale to that level what would be server I should look into.

Wilson Hauck avatar
jp flag
Additional DB information request, please. OS, Version? RAM size, # cores, any SSD or NVME devices on MySQL Host server? Post TEXT data on justpaste.it and share the links. From your SSH login root, Text results of: A) SELECT COUNT(*), sum(data_length), sum(index_length), sum(data_free) FROM information_schema.tables; B) SHOW GLOBAL STATUS; after minimum 24 hours UPTIME C) SHOW GLOBAL VARIABLES; D) SHOW FULL PROCESSLIST; E) STATUS; not SHOW STATUS, just STATUS; G) SHOW ENGINE INNODB STATUS; for server workload tuning analysis to provide suggestions.
Wilson Hauck avatar
jp flag
Post TEXT data on justpaste.it and share the links. Additional very helpful OS information includes - please, htop 1st page, if available, TERMINATE, top -b -n 1 for most active apps, top -b -n 1 -H for details on your mysql threads memory and cpu usage, ulimit -a for list of limits, iostat -xm 5 3 for IOPS by device & core/cpu count, df -h for Used - Free space by device, df -i for inode info by device, free -h for Used - Free Mem: and Swap:, cat /proc/meminfo includes VMallocUused, for server workload tuning analysis to provide suggestions.
Wilson Hauck avatar
jp flag
When you are ready to boost capacity of your existing equipment, please post info requested a couple days ago. With information available to analyze, we can reduce your present system overhead with performance tuning of your Global Variables. Welcome to SO.
ua flag
"concurrent connections" is not a good metric. Better: "queries per second". Almost any machine can handle hundreds of qps if they come from a combination of connections.
I sit in a Tesla and translated this thread with Ai:

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.