I am developing a Magento (CE 1.9.1) store that I want to host on Google's Cloud Platform. One of the options in their pricing calculator is the VM Class, which has 2 options: Regular and Preemptible. From the resources that Google provides, I have a basic understanding of what Preemptible VM Instances are, however, I can't figure out how this would affect my store once it's online. There is a drastic difference in price between preemptible and regular and I want to make sure that I'm not overpaying for services that aren't necessary.

How would a Magento store perform with preemptible instances? Would users experience broken pages or does this mainly apply to large scripts such as cron jobs? Any insight to preemptible instances and website performance is greatly appreciated.

2 Answers 2


From the Google website:

Preemptible VMs offer the same machine types and options as regular compute instances and last for up to 24 hours.

This is an interesting concept. I'm sure you've gathered from their sales pitch that the aim/purpose of using these instances is to aid with one-off jobs, running reports or as you say - bigger cron jobs.

This type of instance of not aimed at running a persistent web server - however, that doesn't mean you couldn't use it for that, in theory...

If your applications are fault-tolerant and can withstand possible instance preemptions, then preemptible instances can reduce your Google Compute Engine costs significantly.

Cool - let's assume that we want to hypothetically explore the ways to significantly reduce your costs. The most important part of this approach is that you need to bullet proof your Magento environment, so that parts of it can die/appear and the system will continue to function as per normal.

Using infrastructure as a service like this you're likely to have an auto-scaled web server environment. This means that the number of servers that are serving content to your clients is relative to the amount of load on your website. More users, more servers. Less users, less servers. In an auto-scaled/load-balanced Magento environment, you often need to de-couple the following:

  • Database: Cloud SQL - persistent MySQL server somewhere
  • Web server: Apache or nginx on each web server
  • Cache: Use memcached or redix hosted on a single server, or cluster of servers. All web servers connect to the cache instance
  • Sessions: As above
  • PHP: Can be run standalone, or as part of the web server instance

If you separate your roles out as above, you'll get a good spread over your application. The weak points are where you don't have failovers. For MySQL you can implement replication (AWS calls it "multi A-Z failover"), for web servers you can implement auto-scaling policies, for cache you can sometimes use a native hosted service like Elasticache on AWS.

The important thing to consider is that if Google kills some of your servers every 24 hours, you need to be able to replace them immediately, pull the latest code, set up the instance and get it into the active server pool before your customers notice anything is different. This normally comes down to defining efficient scaling policies and startup scripts.

Also worth noting is that you can run Docker containers with Google Cloud. This is useful because there are already plenty of Docker containers and docker-compose repositories available for Magento that have been tuned over time by those using them. Some are already de-coupled, however you'd still need to take the DB/cache/sessions out and host them as their own persistent storage.

Sounds like too much work...

There is a Magento Launcher available through Google already. The important thing to note about this "launcher" is that it contains all of the required services in the one container. This is good if you have a small store, and don't need any resiliency, but if you want to achieve something like the above you will need to de-couple and expand. This launcher would likely be a good place to do that - use it as a base.

To be clear, a launcher image like the one just mentioned would not be suitable for a preemptible VM. You would need a persistent instance to run a single image like that.

  • That's certainly a lot to consider. Not being very familiar with this, sounds like it's going to require a very robust plan in order to get this working properly and eliminate user interruptions. Thanks for the information, this will be something that needs a lot more research and planning than initially anticipated should I choose to try for the preemptible route.
    – NotJay
    Commented Aug 18, 2016 at 18:44
  • 1
    Hey - I'd suggest establishing your Magento infrastructure without using the preemptive VMs to be honest, once you have it working you can implement decoupled scalable services, then you can look at using preemptive VMs to reduce your costs once you know the areas you have resilience in and will be able to handle the short lived lifetime
    – scrowler
    Commented Aug 18, 2016 at 19:26

From the description it sounds like you would not want to use these to host a site:

"Compute Engine might terminate preemptible instances at any time due to system events."


"Compute Engine always terminates preemptible instances after they run for 24 hours."

In that case, your site would be down - unless perhaps you're using this as one node in a load-balanced system I suppose.

  • That's unfortunate. If I had multiple instances (multiple compute engines), do you suspect that would eliminate any downtime?
    – NotJay
    Commented Aug 18, 2016 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.