DEV Community

Discussion on: Serverless is just for image processing or can I use to build my API

Collapse
 
kspeakman profile image
Kasey Speakman

Lambda in particular would require your API to be stateless, because you cannot control the persistence or scaling... no single instance, always-running Lambdas. Additionally, if you need it to be responsive, you probably have to setup a script to ping it every few minutes or something. Otherwise the function can be unloaded, and the next request will cause a whole startup process again. Potentially taking a while before it sends a response.

So I would say that these constraints narrow its use as an API, but it is certainly still possible and a good fit in some cases.

Azure has a "serverless" API offering (called API Apps I believe), which is probably closer to what most would expect. You just upload your code, and the instance of your API stays running persistently. How high you can scale it (number of instances) is lower than Lambda though, IIRC.

I'm really surprised AWS doesn't have a similar API offering to Azure. (Or at least I'm not aware of it.)