If you travel to pages like the scale and hosting, you may, rightly, be under the impression that azure functions can scale pretty massively. (At time of writing) 200 instances? Multi-messages per instance? I can do 1000 things at once!
While this is technically true, you better be doing 1000 Hello World's, because Azure Functions running on the consumption model reside in the Azure Sandbox. You will note that the documentation here is much more hidden, but there are some other bloggers who have hit limits as well. The Azure Sandbox is where Free and Shared App Services run, and also consumption functions. Because of this grouping, the limits are smaller than you might think when reading Azure marketing jargon. This is not an Azure-specific issue, as AWS has similar limits (although a bit easier to find). These limits apply across all of the instances combined, and are not per instance.
There are 5 limits, but really only 2 to worry about, as you are likely to hit them before others: Connections and Threads. The connections limit is in the process of being lifted to 600, and all of my apps appear to be operating with the higher limit, but you may still be experiencing the lower limit at time of writing. Before the connection limit change, I never hit the thread limit. After the change, I have never hit the connection limit, only threads.
First off, the Azure functions host itself reserves some of the limit for itself. This makes sense so that the whole system doesn't go down, but you should realize that your actualy limit will be 250 connections or 400 threads.
Ideally, the function host shuts down, it realizes what happened, and it boots back up in a few seconds. No harm done, and you probably didn't even notice unless you have a health monitor.
As you can see from my beatiful artwork, in practice, this happens some of the time, and the rest generates an outage that can last up to several hours, with no warning (unless you yourself create one). If you visit a function during this time, you will get the response "The function host is not running". If you visit the portal during this time, you will get the feared red box informing you Host Thresholds Exceeded: [Threads]. Typically, you will need to restart to resolve this.
There are some general design principles to follow when writing in C# that may not be altogether obvious from the way the interfaces are written. Azure documentation itself actually has some great guidance here, and they go into lots of detail, but I will quickly touch on here:
Over the course of using consumption functions frequently over the past few years, here are some general design principles I follow to avoid problems, some more obvious than others:
In general, Azure Functions are very scalable, once you have a few tools under your belt to help it actually have a smooth experience while scaling.
This site was built using Create React App, with React-Snap to make it static and performant, React Helmet for SEO, and React Bootstrap to skin it. It's hosted on GitHub Pages, feel free to have a look at the open source code. This site is used for testing and changes very frequently, and items are often broken. In the past, it has been built with GatsbyJS, Jekyll, WordPress, PHP, and Raw HTML.