Hello, I am kind of new to ghost, especially configuring and hosting it on my VPS. I managed to install it easily with the use of the CLI and following the guide.
What version of Ghost are you using? I’m running Ghost 4.6.4
How was Ghost installed and configured? I installed Ghost in an Oracle VPS with 1 OCPU and 1 GB of memory using Ghost-CLI version: 1.17.3.
What Node version, database, OS & browser are you using? Node is v14.17.0, MySQL is 8.0.25, OS is Ubuntu 20.04.1, and my browser is Brave.
My problem with my site is that I am experiencing some high memory usage, with my 1GB memory VPS, after a restart, it will go and take 80% of the memory, then even it’s just me tinkering with the site, it sometimes slowly rose to 90%, then eventually end up using all the memory that the thing just broke.
I did some digging into what I can do to lower memory usage, and I tried lowering memory usage of MySQL using this guide I found. And from around 300MB, MySQL now uses 193MB max (on paper).
Not sure if I can really help here but I’d suggest upgrading to 2gb ram, you don’t want your site crashing when you have 10 visitors. Plus a 2gb ram server is normally 7 - 10 dollars.
Yeah, good idea. Taken a break from working with Ghost. But adding a swap file helped in my case. And I was thinking of just using Ghost in this vps as a headless cms, so if the (admin) site slows down, the production site will not be affected that much.
@chof64 can you confirm if the issue is resolved? I am still grappeling with this issue with exact same thing like you - only the ghost site and nothing else. 1GB ram and ghost just eats this up. Running the latest version.
Can you please help with the step by step resolution?
Hello, @jackdaniel, so the issue I had was running out of memory, that’s why my VPS just won’t respond anymore (basically it crashes). So I did some tinkering, with the MySQL (forgot what steps I did) to reduce the memory usage, but no joy.
Then what I ended up doing was adding a swap file (read it somewhere). A swap file is exactly what the name says, it’s a file that your system use as a memory for times when you ran out of memory (depends on how you set it up).
But note that a swap file is way slower than ram, and it would be very slow if used from HDD than SSD, this is because of read/write speeds (read why → ).
Thanks @chof64 for the resources - but is the problem resolved? I had tried using a swap file but the issue of ghost taking up entire memory (1GB) is still there.
Not much image uploads. It was just a gif for background, and icon image, and a few image insert on posts (around 2-4). I was however doing some page creation and post creation.
I’ve only just started using Ghost and will be using lots of images, I’m already finding that memory is getting full quickly all the time with only a handful uploaded. I’ve added a swap file. I had to start the site again from scratch after the droplet crashed and I could not reboot.
@Kevin I am running 1 single site. My posts have 3-4 images per post and that’s about it. Overall 12-15 posts are there, I am still facing this issue. Some resolution here would really be helpful as the swap thing did not work for me.
actually I just realised I’m not even sure if I’ve installed it properly, I installed the jemalloc library but maybe that’s not actually installed the allocator. I just followed this:
Although I do seem to be running ok at the moment and memory seems to be averaging 60% but might be a coincidence…
Yeah, I’ve tried installing it before, I’m not even sure if it was installed properly. I assume it was installed since Oracle Metrics went offline after the restart. But it hasn’t really improved that much memory management.
The thing with swap file, it doesn’t reduce memory consumption. It helps prevent out of memory problems, just put it an extra kind of ram, which is not as fast as ram, but works. Basically trading speed for making your site up.
What you can do if you’re using this, is to just use ghost as a headless cms, and just build your main site (the one you’re visitors interact with) with jamstack, like Nextjs, Gatsby, etc. This might need some coding, but will make your site faster, and less likely to go down since it’ll be cached by servers