Question

Shall I use digital ocean functions opposing to a server?

I have a simple nodejs server that all it does is receive requests to add/modify/delete data from a mongodb database (hosted by mongodb) and returns a response.

Can I rely on functions for something such simple yet important? Will the functions be able to handle any traffic scalably? ex (10k input outputs/second?)

If yes, where can I get started to learn how to convert my app into functions with NodeJS?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
October 12, 2022

Hi there,

Indeed this sounds like a good use-case for a serverless function. The main thing that I would recommend considering is the current limitations here:

Functions have the following limits:

  • The maximum execution duration is 30 seconds each for initialization and function execution.

  • The maximum size of input parameters is 1 MB.

  • The maximum size of result responses is 1 MB.

  • The maximum size of artifacts is 48 MB.

  • Memory is limited from 128 MB – 1 GB, defaulting to 256 MB.

If you fit withing those limits, then you should give it a try!

Regarding the getting started guides, I would recommend starting with the following guide:

https://docs.digitalocean.com/products/functions/how-to/create-functions/

Then after that, here are some sample NodeJS functions that you could also take a look at to get you up to speed:

https://github.com/digitalocean/sample-functions-nodejs-helloworld

https://github.com/digitalocean/sample-functions-nodejs-qrcode

Hope that this helps!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up