How to loadbalance php webservice

Posted February 5, 2021 630 views
PHPAPIPHP FrameworksCloud ComputingDigitalOcean App Platform

Hello I develop a mobile app with flutter which has php(Slim framework) backend as webservice.
What is the best way to keep my app online and Stable.
Does Cloud app fits for me?
Or should i use two droplets behind loadbalancer? If i use lb, how can i update my code in Same time?


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.

Submit an Answer
1 answer

👋 @tasmcan

It sounds like App Platform might be a great choice for your app backend. App Platform automatically monitors your services and will try to bring them back up if they were to go down.

In addition, we offer the ability to scale your app horizontally. Using our pro plans you can increase the number of containers running your backend and we will automatically load balance between them. Here’s a link to our documentation on this.

A nice additional feature is if you’ve enabled Autodeploy code changes when you push new changes to your code base we will automatically build and deploy a the latest version of your app.

  • Thanks @crashoverride
    It adds new containers automatically when high load occurs right? Or should I do that manually?

    Second question is how can i use volumes? I want to store Images and vidoes, I couldnt find documentiton. do you have any guidance?

    kind regards

    • 👋 @tasmcan

      App Platform doesn’t support persistent file systems / volumes currently. It’s something we want to offer though I think it’s a bit far off on the horizon.

      I would recommend using DigitalOcean Spaces to store your files, it’s a cost effective, reliable object storage, and has CDN capabilities if needed. It also uses the S3 API interface so you can reuse existing tooling.