Front-end struggling on VPS with 1GB of RAM

Scrub4 years ago

Hey.

Unfortunately, when trying to view the front-end on a VPS with 1GB of RAM (1Gb/s bandwidth), it hardly is able to present the login page. And often times it times out.

Are there any ways to optimise the memory usage?

Thanks.

Scrub4 years ago

The VPS in question is the Oracle Cloud Free Tier, running on Ubuntu 20.04 Minimal. Rebooting the VPS instance temporarily solves the problem, until the RAM goes back up to 100% usage again.

Anton Tananaev4 years ago

How many devices do you have? What's the message volume? Are you sure there are no other processes running on the server? What database are you using?

Scrub4 years ago

How many devices do you have?

Just one.

What's the message volume?

If you mean in terms of location updates, it's 1 every 10 seconds.

Are you sure there are no other processes running on the server?

I'm sure there are other minimal processes running in the background, but I highly doubt their usage will be high. I'll double-check in a few hours.

What database are you using?

I'm using MySQL.

Anton Tananaev4 years ago

Sounds like it should be working fine, given those details. Have you checked CPU usage?

Scrub4 years ago

Have you checked CPU usage?

I have previously, and the CPU usage hasn't ever reached 100%.

Anton Tananaev4 years ago

We are running a lot of small scale servers with 1GB of memory and never had any issues, especially with a single device. There must be something wrong with the hosting. Maybe they restrict some resources.

Scrub4 years ago
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
mysql        794  0.3 35.3 1776824 353272 ?      Ssl  02:50   0:56 /usr/sbin/mysqld
root        1736  2.9 25.2 2769100 252328 ?      Ssl  06:32   0:56 /opt/traccar/jre/bin/java -jar tracker-server.jar conf/traccar.xml

All other processes are using a combined 10% of RAM, and about 1% of CPU.

MikelCast4 years ago

@Scrub, I can confirm your problem with Oracle VPS and Ubuntu 20.04 minimal...

Works for some days but, after that, CPU usage goes high and the server is unusable.
New instances had the same problem again...

I had the same problem for days until I created a 2Gb swap file and enabled it.
No problem since then

root@traccar:/var/log# free
              total        used        free      shared  buff/cache   available
Mem:        1000340      733152       96288        4344      170900       88436
Swap:       2097148      182016     1915132

You can search for "How to Add Swap Space on Ubuntu 20.04" and follow advices.

P.S: Thanks! you've make me remember that I enabled a 'uptime log' script running each 60s ;)
Don't need it anymore.