Developers October 9, 2020

What is your preferred way of hosting a REST API?

Rcm @rcmy

We are RecoMind, a SaaS for e-commerces that provide product personalization.

We have a backend of machine learning algorithms in python, that are operationalized via an API.

I would love to hear experiences on system operationalization on different clouds. Any detail around pricing or how easy is to develop the solution would be awesome


EDIT Oct 11, 2020. Based on all the answers received, I created a poll

Vote your provider
  1. AWS
  2. Google Cloud
  3. Azure
  4. Heroku
  5. DigitalOcean
  6. Render.com
  7. Vercel.com
  8. Mulesoft
Vote
  1. 10

    Render.com is affordable, easy to use and supports most common use cases and languages.

    1. 5

      a lot of people are saying good things of render

      1. 2

        For good reason in my opinion. It works well for my use cases (primarily Node.js microservices). I think they are a good choice especially for one-man bands as well as startups.

  2. 5

    FastAPI + digital ocean. Cheap, simple, typed endpoints, automated api docs.

    FastAPI is a newer api first framework in Python. It’s great :)

    1. 1

      I like FastAPI, it sounds better than Flask. My only fear with DO droplet is security, DDOS attacks, site/server hacks etc. I don't want to run that background thread in my brain which is always thinking of my server security. I better pay someone and shutdown that security thread :)

      1. 2

        Yeah I think for sure there is a trade-off. Security is super important. i feel the same way about auth/sign-ups. I never roll my own because there is so much that could go wrong and leave you open for attack

  3. 4

    Vercel serverless functions for most cases!
    If it's something that requires fine grained access control, I prefer Django rest framework hosted on AWS.
    In my current venture explodingniches.com, I needed one API (will need more later) for adding the subscribers. The API is right there with the front-end code, thanks to serverless functions.

  4. 3

    Dokku is great if you want the ease of Heroku with full control at a fraction of the cost. You can host it anywhere and it's really easy to install. This year alone I've set up four Dokku servers and had zero issues. It has plugins for about everything: PostgreSQL, Redis, LetsEncrypt, you name it.

    Installing and securing the server with Dokku takes less than an hour. Although, I made a little step-by-step guide for myself so I don't forget anything, which makes installation really easy and quick. :)

    I tend to go with an Ubuntu instance at Hetzner Cloud. They are affordable and the service is excellent. You can start out super small ($3/month) and grow from there with a few clicks. I've been hosting there for 15 years now for many Ruby on Rails projects. As far as I can remember we got a small network outage only once on one of the services.

    Deployment to Dokku is exactly the same as deployment to Heroku (e.g. git push dokku). You can even use Heroku buildpacks to deploy your projects. But Dokku supports many deployment strategies.

    1. 2

      thanks for the info @wout, do you have experience getting Dokku to work with python apps?

      1. 2

        You're welcome. I don't have any experience with Python on the web, but I'm sure you'll find plenty of step-by-step tutorials online. Linode has one that looks like a good introduction, although it's a bit dated.

        That said, I deployed many apps to Dokku in all shapes and sizes. Ruby, PHP, Node.js, Crystal, Bridgetown, MinIO, ... All without too much trouble.
        By far the easiest way is to use Heroku buildpacks, but in some scenarios Docker deployments are the better option as they allow you more granular control.

  5. 3

    AWS API Gateway was surprisingly easier to set up than I thought (compared to a lot of their other offerings). We rolled out a REST API pretty quickly on there, and they have great control over API keys, authorisation methods and rate limiting etc.

  6. 3

    Google cloud’s app engine flexible environment is super easy to use. Feels like Heroku but better priced and more friendly for scale.

    1. 1

      @Austinpena In what language do you program?

      1. 2

        Currently Go for backend, but have used some Python.

  7. 2

    I see a lot of people not using Vercel and I'm curious why.

    Every other option to me is a waste of time and money.

    Are people just not aware of Vercel?

    1. 2

      For my requirements I am not considering Vercel because the Pro starts at $20. I have few API's which are rarely used, currently I am using Firebase functions.

      But for my new project I am considering Render their pricing starts with $7, later if required I can jump to $15.

      -For my client enterprise apps I prefer Azure over AWS.

    2. 1

      hey @ashconnell, do you if they support python development? do you have experience on Vercel with python?

  8. 2

    Firebase I’ve been using with Node, but they do support Python. A generous free tier and really has allowed scaling up and down.

  9. 2

    If cost and flexibility are concerns, I'd check out Google Cloud Run. You just hook it up to your github repo that has a Dockerfile, tell it the port to expose, and hit save. It will scale up and down, only charging you for time used. They'll provision an SSL cert for you along with a domain. Or, you can hook up your own custom domain.

    Since I host everything in GCP, Cloud Run is the absolute cheapest option and you get all the flexibility of using your own container.

    1. 1

      Can I ask you the Container overhead on performance? Also have you tried Google APP Engine? Anything you like to share about your experience?

      1. 2

        Hi Prakis,

        I don't have much info on performance overhead. My workloads typically aren't extremely performance sensitive. But I would probably point you at all of the other writeups on Container vs !Container performance.

        The 1 thing I can speak to is startup times. Startup time is extremely important for Cloud Run, especially when you only have a few running containers. Since Cloud Run will scale down to 0 containers, it will start up the first container when a new request comes through. If the container startup time is slow, it will be directly reflected in the response time for that first request.

        I've gotten around this by adding a "ping" endpoint to the server running in my Cloud Run containers which is hit when someone lands on the web page. This serves to warm up my Cloud Run infra when someone hits the website.

    2. 1

      how is the support? We used GCP in 2014 and got a bad experience with (paid) support, we haven't used it that much since then. Do you have up to date feedback about this?

      1. 2

        I haven't used their support much, and I haven't had a need to. I've hosted my company's infra on GCP for the past 4 years and we've been really pleased for the most part.

        The parts that I'm not impressed with:

        1. Hosted/managed k8s is expensive for what you get
        2. SLAs for Cloud Pub/Sub aren't great
        3. IAM complexity and obtuseness - but I'm not sure this is GCP's fault since IAM is overly complex on all platforms

        The parts that I'm blown away by:

        1. BigQuery federated queries, (and the ability to feed Google Sheets with BQ results... this is a game changer!)
        2. Cloud Run - serverless that uses user-defined Docker containers
        1. 1

          thanks for your feedback, super useful stuff :-)

  10. 2

    My product is a REST API built with Rails and hosted on Heroku.

    1. 2

      Thanks for sharing, I heard heroku is expensive, can you share your experience with Heroku?

      I am thinking of using Render.com for my next project.

      1. 2

        Using a VPS and dokku might be a suitable alternative for you.

        1. 1

          Thank you @JensKnipper
          Security is my biggest fear, With VPS I should take care of server security. That is the reason I prefer PAAS.

          1. 2

            Basic server security is quite easy to achieve. It basically consists of securing SSH and auto installing updates. You may do some further optional steps like installing a firewall or blocking brute force attacks.
            I started an article about that topic weeks ago, but did not really keep up to it to finish it. I am going to focus on finishing it and share it with you ;)

            1. 1

              Thanks alot, I will wait for that article.

    2. 1

      cool, thanks for the feedback

  11. 2

    Based on my expericen on DevOps:

    Stackpath Containers can handle heavy traffic CMS & Symfony REST API without too much DevOps overhead for support engineers

    but they don't have good support on Asia region where DigitalOcean with kubernetes in the also option.(based on few instance may they have improved now)

    I am biased toward Containers in general.

    Pricing wise both claims that they are cheaper than AWS, Google etc but i found that there is always scope of cost optimization based on DevOps planning.

    https://www.stackpath.com/products/containers/
    https://www.digitalocean.com/products/kubernetes/

    1. 1

      Is there any guidance on how to set up a background worker queue that auto scales the number or workers from zero to many based on the number of queued items? My use case is fast video rendering with unpredictable load.

      1. 1

        Hi @marcusstenbeck,

        in past i have used lambda`s for any type of workload. since no wait time regardless of number of users/traffic. (best of image post processing*).

        But....
        video processing can be tricky becoz it requires lot of CPU (GPU may be faster) which means long running processes. Assuming avg video rendering will take more that 1 minute lambda becomes costly fast.

        so next best option is use any job queue manger & spin container/vps/ec2 for handling incoming jobs. This is generic solution, self-managed, here managing Job Queue servers almost same as managing Application Servers aka DevOps cost.

        AWS Batch is semi-managed solution which allows you to optimized cost & at same time reduce DevOps cost. specially using EC2 Spot instances. one can scale horizontally & at same time keep cost low. DevOps overhead is low compare to spinning custom generic solution job queue server.

        https://stackify.com/aws-batch-guide/

        I hope this will help you to think in right direction.

    2. 1

      digitalocean is attracting a lot of startup workloads, probably due to their good prices. Thanks for the feedback!

  12. 2

    AWS all the way though I'm sure any major cloud provider will do the trick.

    It was easy-ish to secure using API keys in beginning but as our API grew we had to start implement fine grained controls which we were able to add using authorizers.

    On pricing, our backend is mostly lambdas which have a pretty generous free tier.

    1. 1

      AWS is definitely one of the most popular options around here. Thanks for the feedback

  13. 2

    If it's lightweight enough try to go with serverless functions. Infinite scalability with 0 management headache.

    1. 1

      what serverless technology do you use?

      1. 1

        I use Google Cloud / Firebase Functions but you can also use Lambda+API Gateway or a higher level service like Serverless to do it.

  14. 2

    I worked on an enterprise application integration project for BigCo. We used Mulesoft to build APIs.

    BigCo has and IBM mainframe that runs cobol. You don't want your web developers to deal with that, so we used Mulesoft to expose those low level systems via APIS.

    Speaking as a developer, I hated working with Mulesoft. But from a business perspective it got the job done.

    For my personal projects, I go through AWS to build all my APIs.

    1. 1

      "Speaking as a developer, I hated working with Mulesoft ..."

      I'm curios, can you articulate?

      I saw Mulesoft on top right of Gartner quadrant for API Management and I was in doubt about that ...

      1. 1

        It's a fantastic tool for most orgs! Don't get me wrong. McDonalds, ATT, Verizon use it. Surely it was acquired by Saleforce for reason. So on and so forth.

        But myself, and the other developers on the team felt that developing with it wasn't exactly a smooth experience. All of the developers who got put on the mulesoft team came from web and app dev backgrounds. MS is a tool that is supposed to be able to be used by non developers. So it abstracts a lot of things from you that, as a developer, you would otherwise have access to.

        To be fair, I'll add two other points: I didn't like that I wasn't doing any coding, instead I was using the drag and drop developer-- Anypoint Studio. Also, BigCo didn't provide us with adequate laptops to support Anypoint, and so development was painfully slow.

  15. 2

    I like to say Heroku but I think once you hit a certain point you might want more control. When that happens I tend to default to AWS. I just have more experience on there.

    1. 1

      Could you elaborate on what kind of extra control you are referring to?

      1. 2

        I like to control OS and things when building. As a mobile person Heroku is great for proof of concept because I don't care about the OS and stuff. Once things grow I want to control a lot more of the IT stack.

  16. 2

    Learnify has our apps on Heroku, we're about to deploy a Flask API that hosts a Spacy NLP model to Heroku as well. Currently paying $7/month/app but as we scale we're going to upgrade to the $25-$50 Production plan

    1. 1

      How do you decide when to scale, is it based on the request per second you are getting our other factors?

      1. 2

        Basically just keeping an eye on my quotas for all of plans. Once any given plan its coming to about 75% of my capacity then I'll upgrade. That goes for Heroku, Mongo Atlas, Google Cloud Storage, etc.

        So I'm manually scaling everything for now; once things start to pick up I'll make sure that I have auto scaling on for things like load balancing and what not

        1. 1

          @rmantao it looks like your site is down just FYI

          1. 1

            What does the error say? Everything looks good on my end

            1. 1

              This site can’t be reached
              leanrify.ca’s server IP address could not be found.
              DNS_PROBE_FINISHED_NXDOMAIN

              ^looks like your link was misspelled!

              1. 1

                ahh thank you, fixed!

  17. 1

    @rcmy a question about your pricing model, it is "Commission-Based Price" but don't mention the percentage about it

    1. 1

      yeah, it depends on the case

Recommended Posts