Coder Social home page Coder Social logo

hosting_reserve's Introduction

Site Reserve

THIS MODULE IS UNTESTED. Use at your own risk.

This module is an extension of hosting_saas that creates a stockpile of sites to accelerate the delivery of new sites.

The point of this module is to enhance the performance of an Aegir-based SaaS service. You can use this module's make_site function instead of using the basic hosting_saas function.

This module is being developped by Praxis Labs for the GetOpenOutreach service.

What is this witchcraft?

In short, this is how this module works:

  1. Make clones of the template site.
  2. When someone asks for a new site, take one of these clones and give it an alias. Hurray, the person can use their new site!
  3. [When no one is looking] Migrate the site to its permanent URL.
  4. Delete old clones.
  5. Repeat

But why?

Cloning complex sites can take anywhere from a 1-5 minutes. Running a simple Verify barely ever takes more than 30 seconds. Gotta go fast.

Installation

All you need is this module and its prerequisites:

You'll probably need your own module or glue code to receive the requests for new sites. Maybe check out hosting_restapi.

Configuration details

You'll see the settings for this module in Hosting -> Site reserve.

Reserve

When we talk about the "reserve", we're talking about unused clones.

Full reserve size

The maximum number of sites in the reserve.

Minimum reserve size

When there are fewer than this many clones in the reserve, we ignore the refilling time window restrictions. This means that we'll make new clones as soon as possible. You can see this as an "emergency reserve".

If you set this to the same number as the full reserve size, the cloning window times will be inconsequential (but still respected for the deletion of old clones). It doesn't make sense to set this higher than the Full reserve size.

The default setting is 1 because only the busiest services would need more than that in reserve at any given time.

Clone life time

Clones will be deleted after they've been in the "reserve" this long.

We usually need to delete old clones because we will reguraly make changes to the template site, so clones will be out of date.

If you set this to infinite (0), you'll need to manually deleted the existing clones when you make changes.

Cloning window

In the settings you'll see "Time window for refilling".

The point of this module is to have pre-made clones that we can quickly alias to serve sites very fast.

But when do we make the clones? If we make them during the busy hours, we run a higher risk of a clone operation running when we receive the new site request. Since the tasks are run sequentially, we'd have to wait for the clone operation to finish, making this no more efficient than the normal clone method.

This is why the default setting is in the middle of the night since that's when there's the least traffic. (Note that your server time may not be the same as your local time.)

This is also when the old clones are deleted. The default site expiration time is 23h because cloning generally takes a few minutes, so if we set it to 24h we could gradually slip until at some point there's no new clone for 48h.

FAQ

Q: How does this module know which site to clone?

A: We just use the hosting_saas settings. See Hosting -> SaaS.

Q: It's not working!

A: That's not a question. There are many things that can go wrong here. Make sure you configured hosting_saas and you have some way to create requests. Check the variables with drush vget hosting_reserve.

In particular, the hosting_reserve_next_clone_id variable may need to be changed if you manually created some clones.

If you think you've found an actual bug, please open an issue in the GitHub queue.

Q: Can I just use this module without configuring it?

A: Pretty much. It will use the hosting_saas settings, so you'll still need to configure that first.

Q: What happens when I request a new site and there are no clones?

A: The module will use the default site creation function from the hosting_saas module.

Q: Why don't we just use an aliased clone permanently? Why do we need to migrate?

A: Historically, some errors have appeared only when using the site through its alias. No alias = fewer moving parts. Also, managing a thousand sites named hosting-reserve-N is a way bigger pain than if they have the proper title.

Q: I think this should do [X].

A: Pull requests welcome. If you're not a coder, submit an issue and we'll see what we can do. If you need this for commercial use, consider sponsoring the development.

License

(C) 2015 Guillaume Boudrias [email protected] (C) 2015 Praxis Laboratories Coop [email protected]

Distributed under the terms of the GNU General public license (GPL). See LICENSE.txt for details.

hosting_reserve's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

cloudxtreme

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.