by a domain name web and hosting

Cloud Hosting: The right preparation for the perfect transition

Cloud hosting is the future. New providers come on the market, also for the scripting language PHP. But switching from traditional hosting to the cloud poses some hurdles that can be handled with the right preparation and the right specialists.

The cloud has been praised for a few years as a solution for all imaginable concerns of today’s developers. So much so that for some time the term almost ran the risk of being laughed at as a pure buzzword. In fact, cloud computing can offer many interesting benefits, especially in hosting: cloud hosting offers the ability to scale infrastructure more easily, faster, and more cost-effectively, and thus adapt it to current, possibly short-term, needs , It also eliminates the hassle of taking care of server maintenance and upgrading with new technologies.

The hurdle to approach cloud hosting yourself is gratifyingly deep. All providers can provide their own server capacities within a few minutes. However, to make it work in practice, it is a good idea to become aware of the peculiarities and limitations of cloud hosting. A look at the example of Cloud Hosting with PHP will show you where the possible pitfalls lie and how to successfully bypass them. In principle, the notes also apply to other languages ​​and frameworks.

Death to the FTP

The fact that cloud hosting is quite different from traditional hosting is already shown in the way the data is sent to the server: This does not work via FTP, but only via a push via Git. So it’s also an argument for it, even for smaller projects use professional versioning. The effort is minimal, the benefits of large and the handling thanks to graphical interfaces such as Tower [1] also suitable for users who shy away from the command line.

The access rights for the upload are granted per computer via SSH keys. Also, their creation is not nearly as complicated as it seems. In addition , each provider explains the process more or less detailed [2].

Flexible server selection

Since cloud hosting eliminates the need to take care of the physical infrastructure, it also eliminates the knowledge of where your data is located. Load Balancing, which distributes requests to different servers, and scales the capacity, means that two consecutive requests from a visitor are likely to end up on two different servers. A “shared state”, ie an area to which each request can access, does not exist. Instead, it is always available on every server, which was also transferred with the Git repository.

Outsource and centralize

Outsourcing and centralizing is therefore announced. This mainly affects temporary data such as sessions and user uploads.

For offloading session data, PHP provides a simple, home-based path through the session_set_save_handler () function. This can be used to address your own functions, for example, to open a session, close or read and write data within it. These functions, in turn, can be used to manage the data with a database accessible to each server. For this reason, there are ready-made classes [3], which can achieve the desired effect with a few lines.

Manage session in MySQL database
Depending on the cloud hosting provider, Memcached  may also be used to store other short-lived data . Memcached makes it possible to provide data up to a size of one megabyte across servers and thus independently of the call. However, if this option is not supported by the provider of choice, there is no alternative to storing it in the database or on an external storage service. Under no circumstances is it suitable to create temporary files that are stored in the file system, since these too are only available on one server.

Leave a Reply

Your email address will not be published. Required fields are marked *