Mount Royal viewpoint by day
Montreal, QC
All projects

Observability on my VPS: 15% of RAM reclaimed

On this page

My server was working... most of the time. Latency spikes showed up without warning, then vanished before I could figure out why. In two weeks, I set up a complete observability stack, and the numbers spoke for themselves: 15% of the memory was taken up by useless processes.

Context

This portfolio runs on a small VPS with 2 GB of RAM, alongside several other applications. Each one lives in its own Docker container; this site, for instance, is deployed by a GitLab CI pipeline.

Until then, there was no central monitoring: every incident meant a manual investigation, and every decision was made blind.

The problem

The server suffered from sporadic latency and slowdowns, with no obvious cause. Overall activity was opaque: there was no quick way to spot a bottleneck, or to tell which applications were using the most resources.

Without data, every optimization was guesswork.

The solution

I designed and deployed a complete observability stack that answers three questions: what are visitors doing, what is the system consuming, and what do the logs say?

ToolRole
UmamiVisit statistics and user behaviour, in real time
PrometheusCollects system and application metrics
Loki + AlloyCentralizes and indexes the logs of every service
GrafanaClear, interactive dashboards
Prometheus alerts + SlackA notification as soon as a critical threshold is crossed

Everything in one place

Grafana gives access, in one place, to Prometheus metrics and to the logs that Alloy collects and Loki indexes. When a latency spike shows up, I just look at what was happening at the same moment: which container was consuming resources, and what it was writing to its logs.

Being warned rather than finding out

Prometheus alerting rules send a Slack notification as soon as a critical threshold is crossed. No more stumbling upon problems by chance: the server tells me.

Results

  • 15% of RAM freed: the metrics revealed useless processes, which I was able to remove.
  • The most resource-hungry applications identified, so I could prioritize optimizations where they really mattered.
  • A server that sends warnings instead of being watched by hand.

Takeaways

  • You can only optimize well what you measure. Before this stack, I had hunches; after, I had numbers.
  • Metrics and logs complement each other: metrics tell you when and how much, logs tell you why.
  • Observability belongs even on a small server. Two weeks of setup were enough to get concrete gains out of it.