Estimating server load and hardware requirements for UNA
Choosing the right server configuration and predicting operating costs for running a UNA-powered site may be important for your business strategy planning. This guide may help you choose correct hosting and plan for scale.
Please remember that this is a simplified approximation for the default UNA setup with standard modules only. The real site can have many more modules from 3rd-party developers (which can affect on-site load, space requirements, etc.) or can be focused on resource-intensive tasks that may call for a different estimation (i.e. video conversions, high-storage sites like pro-level photo sharing, etc.)
How to calculate load and choose proper hardware.
The load is very dependant on the number, purpose, functionality and quality of installed modules and the site template. Therefore it is almost impossible to predict it beforehand. But if you have a sample setup of the desired site configuration or pre-production setup on the web server, it is possible to at least predict the memory usage.
To do it install "Profiler" module, this module shows different timings at the bottom of every page for site administrator (by default). Try to open different pages and watch for memory usage and page execution time.
Try open different pages and measure average "Memory" and "Time" values. Let's assume that it is 20Mb for memory usage and 0.5 seconds execution time. Then, if you have a web server with 4G RAM (for example) the web server is capable to handle:
4G - 1G (for system usage) / 20 Mb ~ 150 simultaneous requests.
Please note, that simultaneous requests aren't a number of online users. Users make requests to the server one time in several seconds or a dozen of seconds.
If it is a mostly static site (without much dynamically changing content like the Messenger, Shoutbox, Rocket.Chat, etc) then one request in 30 seconds from one user is likely. In this case, the server is capable of handling the following number of online users:
30 (average seconds per one request from one user) / 0.5 (our average "Time" value) * 150 (simultaneous requests) = 9000 online users
If it is a dynamic site (with the messenger, active timeline, notifications, etc.) like most UNA sites, 1 request from one user every second on average is likely. In this case, the server is capable of handling the following number of online users:
1 (average seconds per one request from one user) / 0.5 (our average "Time" value) * 150 (simultaneous requests) = 300 online users
As you can see a dynamic site require 30x more resources than a static site.
This is a very rough calculation which considers only server memory usage, while CPU usage is not counted at all. You may have CPU-intensive usage and low memory load and vice versa. For example, video conversions may cause very high CPU usage.
How to calculate load and choose proper hardware for the database server
DB server is dependant on many factors and can not be precisely planned until the site use patterns are observed in production. Just make sire to follow these guidelines:
- Tune MySQL settings for your needs, recheck settings as your database grows and the load increases. Try this tool to check and tune your MySQL settings: http://mysqltuner.pl/
- Installing more RAM can help a lot. Refer to the first advice to see if you need more RAM.
- Use InnoDB DB engine instead of MyISAM if you have high load.
- Store database tables on SSD disks, for the better performance you may need to tune MYSQL especially for SSD disks. (Note, that UNA Cloud servers work on SSD disks only).
- If the load is too high, you may need a server cluster for your MySQL DB.
How to calculate database and files storage needs
Storage varies depending on number and types of installed modules. The better method is to start site and when you will have a number of users, calculate average data size in DB and on Disk and multiply this values on some number of users you need going to plan for.
In the following calculations, we are using some sample UNA setup. The site has only 9 users, all standard modules are installed and almost every user has some content (text content, photos, videos and sounds) in different modules.
Let's assume that we need to calculate future storage for 100 000 users.
- Current size: 1.5 Mb
- Number of users: 9
- Average DB space per user: 1.5 Mb / 9 ~ 0.167 Mb
Approximate DB Storage required for 100 000 users
100 000 * 0.167 Mb = 16700 Mb ~ 16 Gb
- Current size: 374 Mb
- Number of users: 9
- Average DB space per user: 374 Mb / 9 ~ 41Mb
Approximate Disk Storage required for 100 000 users:
100 000 * 41 Mb = 4 T
Note, that UNA supports remote storage, so you can use, say, AWS S3 storage for quick and price-efficient media storage.
Hosting Server Costs
As a rule of thumb, dedicated servers would be more cost-effective for large sites with a predictable load. You can get a configuration with more RAM, storage and better CPUs compared to a similarly priced Cloud-based server. On the other hand, Cloud-servers can be scaled up more easily and it is possible to start with a smaller instance, scaling up as required - this approach may prove to be more cost-effective for a small to medium community site.
Another consideration is that SSD-based servers will always cost significantly more than a HDD-based ones, so it is best to use SSD-based servers only for the web-server and the database while leveraging external storage for media files.
For a rough estimate, let's take una.io community with a few active modules, messenger, albums and timelines enabled, but no specific focus on video sharing, file storage, etc.
40 online users / 10,000 members
$100/mo (UNA Cloud4)
$50/mo - dedicated server + $50/mo UNA Pro license
At this size only a few "online" users are present at any given time, so a basic server like UNA Cloud 4 would be sufficient. On-server storage can be used for the database, and media storage needs would be in the range of 50Gb, so the media can also be stored on site. A dedicated server with similar specifications would cost about $50. Note, that UNA Cloud comes with included UNA Pro plan, so this choice may still be preferable.
80 online users / 50,000 members
$150/mo (UNA Cloud8) + $100/mo for AWS S3
$100/mo - dedicated server with 2 disk arrays + $50/mo UNA Pro license
At this size you may expect more online users during peak times. Still, on-server storage can be used for the database. While at higher numbers average storage uptake tends to go down, we would still recommend connecting remote storage at this scale - you may need around 300Gb, which is likely to be relatively expensive with an on-server SSD.
A dedicated server with similar specifications would cost about $100 and may include a disk array for media storage.
150 online users / 100,000 members
$200/mo (UNA Cloud16) + $200/mo for AWS S3
$150/mo - dedicated server with 2 disk arrays (or SSD), extra RAM and upgraded CPUs + $50/mo UNA Pro license
A community with 100K members may result in 150 online users during peak times. Database will take only about 3Gb, so it's best store it on-server. Media may take 500GB, so it is definitely best to leverage remote storage.
A dedicated server with similar specifications would cost about $150, as it will require RAM and CPU upgrades as well as multiple disks for media storage and redundancy.
300 online users / 200,000 members
$400/mo (UNA Cloud32) + $400/mo for AWS S3
$300/mo - dedicated server + $50/mo UNA Pro license
When you reach such stage, some of the costs "per members" can be reduced significantly. Typically remote storage pricing for higher allocation is lower and you can pre-order fixed-price servers. Usage patterns become more established and it is possible to optimise the site to meet specific requirements for best efficiency. Even with 300 online users during peak times the site is likely to operate well on UNA Cloud 32 or similar server. The database can still be stored on-server but may need to be separated soon. Media may take about 1TB, making it expensive to store media on-server's SSD even if you're using a dedicated box.
500 online users / 500,000 members
$800/mo (UNA Cloud64) + $1,000/mo for AWS S3
$600/mo - dedicated server + $1,000/mo for AWS S3 + $50/mo UNA Pro license
At half million members stage, you may be seeing around 500 online users. It is very important to optimise database requests, site configuration, turn off unused features and minimise clutter. UNA Team would be happy to assist with this process.
1 Million Members
Starting from this stage you'll need custom dedicated server setup (you'd likely need to make a 2-3 servers cluster).
A dedicated server will have to use remote storage, so while you'd need to further upgrade CPUs and RAM, most of the storage disks can be removed.
While cloud server can be easily scaled up to 512Gb RAM and 64 CPU without adding complexity.