How to increase VPS memory
One of the most important aspects of upgrading a VPS is memory. We have compiled a list of what changes can be made by increasing memory and how much more space is needed.
Posted at: 2023.3.3
First, let's figure out "Why is there not enough memory?
When there is insufficient memory in a VPS, it is easy to think "I need to upgrade my plan," but in VPS where memory optimization must also be done by the user, there are many cases where "memory is sufficient, so proper optimization and management is not done.
In VPS, "increasing memory = upgrading the plan," so there is a cost for fees and work.
Before incurring such costs, first check to see if the VPS memory is being used properly.
Resolve memory shortages in VPS
Let's check what is squeezing memory.
First, determine what is causing the memory shortage: If it is a web server, the solution depends on whether it is the application, the database server, or the bag-round processing that is using a lot of memory.
If a particular program is squeezing memory, then tune the system to reduce memory usage. In some cases, this can be easily done with a configuration file, while in others, the program itself may need to be reviewed.
Check the "memory allocation" to applications.
If the server is still running slowly even after increasing the amount of free memory by reducing the number of memory-consuming programs and applications, it is possible that the memory allocation for applications is set too low.
Generally, when you run a program or application on a server, you describe how much space it will use in a configuration file.
For example, if you have a VPS with 4GB of memory and you have set it to use only 1GB of memory on the configuration file, there is still some room left over, so increase the memory limit and check if the operation changes.
Each application and language has different settings for memory allocation, so check each one.
Is SWAP properly configured?
A common problem with Linux servers is the omission of SWAP settings.
It used to be said, "If you let SWAP run, you lose." However, since today's VPSs have fast storage with SSDs and the OS side is optimized for SWAP processing, there is no significant disadvantage to setting SWAP.
Of course, it is best to operate stably without SWAP, but if you want to increase memory capacity quickly and cost-effectively, you may want to try setting up SWAP.
How to set up SWAP on a Linux server depends on the OS you are using, so please look up "XXX SWAP Settings" or similar.
How to increase VPS memory
If you are running out of memory even after the optimizations we have seen so far, you should increase the VPS memory to deal with the problem.
There are two ways to increase VPS memory.
- upgrade your VPS plan
- add additional memory to your current plan
For a typical VPS, the only way is to "upgrade your plan".
Except for cloud computing and other services that allow users to customize server specs, basically the only way to increase memory on a VPS is to upgrade the plan.
VPS plans are configured to enhance the three specifications of "the number of CPU cores, memory capacity, and storage capacity" for each plan, so upgrading a plan will also enhance the CPU and other specifications.
You may think that you are lucky to be able to upgrade not only memory but also CPU, but on the contrary, it is not cost-effective because you will be upgrading CPU and storage that you do not need.
In anticipation of such cases, some VPS providers offer "memory enhancement plans" in which the CPU and storage remain the same, but only the memory is increased.
If memory shortage is a pure problem, it is more cost-effective to choose a plan that allows you to add memory only.
With a cloud-based system, only memory can be added.
One of the advantages of cloud servers over traditional VPS is the ability to customize detailed specifications.
With VPS, it is common knowledge that "1GB or 2GB of memory for 1 CPU core" is the norm, but with a "virtual instance service" equivalent to VPS in a cloud server, it is possible to customize specifications such as "1 CPU core and only 8GB of memory.
How to choose a plan upgrade and what to expect
Try "two plans up" if you think you are seriously short on memory.
If you are using an entry-level VPS plan (with about 1GB of memory), try using the "two higher plans" such as 3GB or 4GB instead of the 2GB memory plan one level up.
In doing so, it is best to "create and test the same server on the two higher plans" using a backup of the production server, rather than suddenly upgrading the production server.
If you set the DNS destination to the test server for a certain period of time and monitor the server load, you can determine if it is still not enough or if there is room at all. If you can afford it, you can move it down one level.
If you don't want to spend as much as possible, you should be able to do the test with a VPS that charges by the hour for a few hundred yen.
Think about "what happens after" the upgrade.
If the server you are running out of memory is a 1GB memory VPS server, there are many plans available to upgrade beyond that, but if you are running out of memory on an 8GB or 12GB server, and some VPS providers do not have upgrade plans, you may not be able to upgrade to the next level. There are cases where the specs would be upgraded to the extreme.
If you are going to change plans anyway, take this opportunity to think about even the "next upgrade" and change plans.
It is also possible to compare plans among plans, and also compare plans of other VPS providers together and consider switching.