Shared Hosting
Getting straight to the point - simply don't use it - ever :-) Magento requires tuning of your MySQL servers, your web servers, caching servers etc.. On a shared hosting environment you don't have access to these settings. Save yourself a lot of pain and setup your own infrastructure.Recommended Infrastructure Setup
Setup your Magneto environment on AWS (Amazon Web Services). It's extremely cost effective and if you follow the below guidelines you can scale up your servers as your server load increases over time.Route32 for DNS
Why? Because it is super simple to setup, easy to maintain, has redundancy and is really cheap!EC2 & Load Balancer for Front-end web servers
You will want to run at least 2x EC2 front-end servers for your Magento website both sitting behind a load balancer.
"Load balancers allow you to run multiple front-end (Apache/PHP) servers for your Magento installation. They are great for performance, redundancy and for creating downtime free releases."
- Setup 2x medium instance web servers for your Apache/PHP/Magento codebase.
- You will want to use EC2 servers that have at least 2 CPUs (Magento in most cases will perform much better with more CPU power than memory).
- Setup the 2 servers identically (look into CloudFormation if you want to automate this).
- Now setup 1 load balancer for your 2 front-end servers.
- Add your 2 front-end servers to your load balancer (You will need to setup a polling end-point so the load balancers know the server is in service). It could be as simple as having a PHP file in the root directory like below:
/load-balancer-status.php
<?php var_dump($_SERVER['REMOTE_ADDR']); ?>
In your Amazon Load Balancer your health check should look something like:
HTTP:80/load-balancer-status.php
EC2 & Load Balancer for admin web servers
It is good practice to run your Magento admin on its own servers. This will ensure that your staff and admin users wont affect your front-end website if using Magento admin heavily. It also allows you to add a layer of security to your Magento admin (and lock it down to just your office network).
- Setup 2x medium instance admin web servers (these can be identical to your front-end web servers) for your Apache/PHP and magneto codebase.
- Again, you will want to use EC2 servers that have at least 2 CPUs.
- Setup the 2 servers identically.
- Now setup 1 new load balancer for your 2 admin servers.
- Add your 2 admin servers to your load balancer (like you did you front-end servers).
RDS for your database
You will want to run your database on a separate server to your admin and front-end servers. This will give you much better performance and decouple your application servers from your database (good for scaling).
- Setup 1x medium RDS instance for your database.
- Import your initial MySQL database dump to this database.
- You will want to leverage the power of MySQL replication for your Magento website, so within the RDS configuration of your database above, create a 'read replica'.
- This way you can share the load of your MySQL queries over both of your databases (more details about how to configure Magento for read replica in Part 3 - MySQL setup and performance).
Elastic Cache
Magento needs cache for it to support even just a few users efficiently.
- Setup an elastic cache instance (Redis), or setup Memcache on your front-end and admin servers.
- Configure Magento to use this caching service
- More details about how to configure Magento for caching in Part 6 - Magento Caching.
CloudFront CDN for product images
Using a CDN allows you to offload a lot of static resources (like product images, CSS, Javascript etc...) to CDN servers all around the world. This will free up your server resources.
- Setup a CloudFront distribution within AWS.
- This will give you a URL like:
d1u5cic2xm0cb9.cloudfront.net
that we can configure later in Magento to serve content from.
Part 2 explains how to setup CDN within Magento
SES for transactional emails
Your Magento website will send out transactional emails (contact form emails, order emails etc...). You may as well keep this on AWS with simplicity.
- Setup SES within AWS.
- You will need to configure your domain, and allowed senders.
- You will also have to apply for production use (which can take up to 48 hours). Make sure you do this a few days before launch.
Reserved instances
You can dramatically reduce your AWS costs by purchasing reserved instances. You should purchase 'heavy utilisation' reserved instances for all of your EC2 and RDS instances (your costs will be about 1/3 to 1/2 of the costs of not purchasing reserved instances).
Part 2 - Prepare for Scalability
Part 2 - Prepare for Scalability
0 comments:
Post a Comment