You can’t have server-side script execution without servers, so let’s talk about infrastructure. Fear not.
Your triggers and custom functions are executed in the context of a node.js process running in a dedicated Realtime Cloud Storage server instance with 1GB of memory.
We call these instances, mules.
According to Wikipedia “it has been claimed that mules are more patient, sure-footed, hardy and long-lived than horses, and they are considered less obstinate, faster, and more intelligent than donkeys.” so we think it’s just right for the highly-available and highly-resilient infrastructure modern applications require.
As you might have guessed, for the sake of scalability and high-availability, your triggers and custom functions can also be executed across a distributed fleet of mules (aka cluster). In this case the Realtime load-balancers will distribute the requests evenly among them.
To keep your triggers and custom functions always responsive we are using Nubium Dynamic Cloud Manager under-the-hood, our cloud orchestration and automation tool to auto-scale your mule fleet according to the traffic they are getting in each moment, adding more mules when requests are going through the roof and remove them when they are no longer necessary. To keep your costs under control you’ll be able to specify the maximum number of mules your infrastructure may scale-out to.
The following snapshot shows a Code Hosting cluster with two mules, each handling over 2,700 requests per second.
Since a single mule is able to respond to thousands of requests per second, for some applications one mule will be more than sufficient (this obviously depends a lot on the performance of your code). But rest assured, if your app becomes suddenly very successful and you require more mule power, we’ll deploy some more for you in less than a minute.
So, now you know you'll have mules to execute your scripts and you might be wondering how you will deploy your code. In the next section we'll guide through the details of the Code Hosting integration with Git.