DEV Community

Cover image for How I built architecture of uptime monitoring service

How I built architecture of uptime monitoring service

Victor on September 17, 2020

Table of contents Intro Requirements VPS Provider and Servers Technologies used How a node works How the core server works To sum up Wha...
Collapse
 
klvenky profile image
Venkatesh KL

Wow man you're amazing. I have just visited your website and it looks very elegant. No non-sense, very simple & shows what it does. Wonderful.

That's does a lot of motivation to build something that could help people and when it looks like a simple trivial job. I think you've done a wonderful job, that too while you were working at a full-time job. You really have a great productive mindset.

I am sure you should've invested good amount of time planning it so well.

In short, Wonderful idea. All the best
Cheers 🍺

Collapse
 
vponamariov profile image
Victor

Thank you! :)

At first, I was tracking the time I spent on the project, and it was like 620 hours. Then I stopped. So in total, I spent maybe 1000+ hours :)

Collapse
 
lifeofkar profile image
Karthik R

Woah amazing.
I have also took up similar project myself and it's still in progress from past couple of months.
Although I've based it via ping check only.
And doesn't include features like you have XD

Hope to complete it very soon 💗

Cheers

Collapse
 
vponamariov profile image
Victor

Just don't give up. It took me a year to build this!

Collapse
 
priyajain6651 profile image
priyajain665 • Edited

Great work! I would like to read more articles related to... How architecture developed.
Thanks for sharing.
Happy coding 🙂.

Collapse
 
vponamariov profile image
Victor

Thank you

This is what I need too. It's not hard to find something like "how to center a div" or "jquery send form", but it's hard to find how big products work inside.

For example, if people shared their Database structure or something :)

Collapse
 
vponamariov profile image
Victor

In code we trust 😎

Collapse
 
mrbenosborne profile image
Ben Osborne

Hi Viktor,

Nice work here and as you said it's not as easy as it looks.

You could use Golang which is superb for its concurrency, each go routine only takes up 2 kilobytes!

I am also taking on this type of project in my spare time and at the planning stages at the moment.

I am using Golang for the processing of queues and actually sending out HTTP requests / pings etc and Laravel for the rest.

Question Time

I am stuck at one thing, the part of the process where the system fetches checks to be processed on the queue etc, what if you have 5 million checks to be processed?

  • You cannot fetch all checks at once, you would run out of memory.

  • You could batch the checks, ie. fetch 200 checks at a time from the database, with this approach let's say it takes 0.1s to fetch 200 checks and push them to the queue.

That would be 5,000,000 (checks) / 200 (batch) * 0.1 (seconds) = 2500 (seconds)

2500 / 60 = 41 minutes...

How is this scale-able and have you hit such an issue yet?

Thanks
Ben

Collapse
 
meatboy profile image
Meat Boy

Love the concept and simplicity of the website. Would be great if user can check any TCP port and/or more popular protocol. I am missing at least DNS, POP and IMAP

Collapse
 
vponamariov profile image
Victor

Well, I have this is plans. But most users need HTTP checks.

Hmm I now realize that it's not easy to integrate them, since they have different attributes I guess.

So I'll need a monitor "type" and bunch of additional columns for monitor_checks table.

The implementation of request should be easy though, so many nice libraries are here :)

Collapse
 
dragstor profile image
Nikola

Great summary, Viktor!
Always the pleasure to read your stuff :)

Collapse
 
vponamariov profile image
Victor

Oh, I know you! :) Thank you!

Collapse
 
ptejada profile image
Pablo Tejada

Are you really making a profit?

Collapse
 
vponamariov profile image
Victor

Started to make it in September

Collapse
 
khandakerjim profile image
Khandaker Jim

What should I use instead of Redis? RabbitMQ or Kafka or do you have any recommendations based on your experience?

Collapse
 
yellow1912 profile image
yellow1912 • Edited

I wonder if we can use coroutine from swoole for example and if the performance would be better.

Collapse
 
vponamariov profile image
Victor

Woah, never heard of coroutine, will check it out
Performance is crucial here since the more checks should be done, the more Memory/CPU I'll need

Collapse
 
tanghoong profile image
tanghoong

Thanks for sharing, I was just started working my own version, reading your post it take quite a lot of scenario to take care.

Collapse
 
olavoasantos profile image
Olavo Amorim Santos

Nice read and great idea.

Did you consider a serverless approach? You could probably save some bucks in infra using lambdas with sqs queues to ping the URLs.