1

I have a little app(PHP) that uses data from a third party. That data is processed constantly and saved into a database. And now i want to create a RESTful API to allow access to that data.

Should i keep my app on the same droplet as the API or should i separate them?

The API will mainly be called by a Python app(also mine) which runs on Windows.

PHP app is on a subdomain like this: app.example.com[Droplet_1] Thinking about creating the API on a second droplet with a subdomain like this: api.example.com[Droplet_2]

P.S: I'm currently running on DigitalOcean droplets.

1 Answer 1

2

Can both programs run from the same node?

  • Are the programs happy with sharing their node?
  • What level of service are you trying to establish?
  • Is there enough compute resources on that single droplet to maintain both programs, especially during peak load?
  • Is there an overriding concern such as security, reliability, or a business/country policy/regulation that prohibits both programs from sharing the same machine?

If there is a reason to use more than one node, then you should probably do that (or face the consequence of not).

Either way it is your choice whether to use or not use more than one droplet.

7
  • Hey @Kain0_0 - Yes, both programs can and are pretty happy to share their node. The level of service regarding the api is around 150.000 calls/day(very niche but all the calls from all my clients are concentrated around certain hours - hours that change daily). With calculating the compute resources needed i have some problems - is there a guide you could provide(sorry)? What do you mean by "overriding concern such as security"? Thank you!
    – emma
    Jun 18, 2019 at 5:32
  • 1
    Observe your program under simulated load and see how much cpu/memory/hd throughput and capacity there is and measure responsivenss/latency on the requests. That gives you a profile. So if the program spikes to 2gb of ram underload, then do not put it on a machine with less than 2gb + OS ram. Similaraly for CPU/HD speed and size. I cannot easily give you a rule of thumb for these things as i've seen some systems groan under 300 requests a minute and others zip along in the hundreds of thousands per node.
    – Kain0_0
    Jun 18, 2019 at 6:50
  • Ok so in the end it all comes down to "do you have enough resources on one? if yes you're good to go"?
    – emma
    Jun 18, 2019 at 6:55
  • 1
    Overriding concerns are non-tangibles. They have no actual impact on whether or not a machine is physically capable of running your program, but are important none the less. Some are practical like preferring to keep the database on a separate machine. The IO load of a DB often conflicts with the load of a batch/online program. Some are about risk avoidance such as running old vulnerable code on machines without critical programs. That way if they crash, or someone hacks them the damage is limited.
    – Kain0_0
    Jun 18, 2019 at 7:01
  • 1
    "Is there an overriding concern such as security, reliability..." ? Is your API a security issue? If it were compromised would the comprise cause more damage simply because it is on the same node as this other program? Is that an acceptable risk? What commitment to service availability are you making? If your batch process crashes will it take down the API? If it does is this acceptable? What is your upgrade story? What happens if you need to update the PHP runtime? Will that mean you have to review and retest both programs? Are the administrators allowed access to both programs?
    – Kain0_0
    Jun 18, 2019 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.