Code Monkey home page Code Monkey logo

uptime's Introduction

Uptime

Experimental project to monitor website uptime.

The meat of it is in SiteMonitorHandler, SiteMonitor, CheckHandler, and Checker.

SiteMonitorHandler is responsible for spawning new SiteMonitors and tracking their pids.

SiteMonitors are responsible for keeping track of what site they're monitoring, what their current status is, and what time it was last checked. SiteMonitor's are also responsible for triggering each check.

Because we don't know how many sites are going to be monitored, we want to make sure we don't run into a situation where we perform hundreds of HTTP requests all at the same time. To prevent this we use a GenStage flow.

Using GenStages we have a single producer, CheckHandler, and many consumers, Checkers. If we have 5 Checkers subscribed to the CheckHandler events, then we will only ever have up to 5 concurrent HTTP requests all at once.

One thing to keep in mind is that if your checks requests are coming in faster than your checkers can consume then your queue will continue to grow bigger and bigger. The only way to handle this would be to increase the number of subscribed Checkers or to request checks less frequently.

To start your Phoenix server:

  • Run mix setup to install and setup dependencies
  • Start Phoenix endpoint with mix phx.server or inside IEx with iex -S mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Learn more

uptime's People

Contributors

bkilshaw avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.