Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I host Website and REST API on the same server or split?

I have a web application that consists of Website and REST API. Should I host them on the same server or should I host them on different servers? By "server" I mean a server cluster - several servers behind load balancer.

API is mostly inbound traffic, website - mostly outbound.

If it matters - hosted on Rackspace and/or AWS.

Here is what I see so far:

Benefits of having Website and REST API on the same server

  • Simple deployment
  • Simple scaling - something is slow - just launch another instance
  • Single load balancer configuration
  • Simple monitoring
  • Simple, simple, simple ...
  • Effective use of full duplex network (API - inbound, website - outbound)

Benefits of splitting

  • API overload will not affect website load time
  • Detailed monitoring (I will know which component uses resources at this moment)

Any comments?

Thank you

Alexander

like image 714
Alex Uslontsev Avatar asked May 27 '09 17:05

Alex Uslontsev


People also ask

Do I need web server for REST API?

The web server is one of the most important components of a REST API. In this post, you will start your REST API project by creating some initial directories and files. Then you'll create a web server module and wire things up so that the web server starts up and shuts down correctly.

Can I host a website on 2 servers?

Yes, definitely you can host one website on two different host. But one domain only can run one website at a time. Suppose example.com can use one host at a time to run website. You can select which host.

Do I need a separate server for database?

Putting your web site and database on separate dedicated servers provides much better security and performance.

Is RESTful API a web server?

A REST API (also known as RESTful API) is an application programming interface (API or web API) that conforms to the constraints of REST architectural style and allows for interaction with RESTful web services. REST stands for representational state transfer and was created by computer scientist Roy Fielding.


1 Answers

Just as you stated, in most situations, there are more advantages in hosting the API on the same server as the website. So I would stick with that option.

But if you predict allot of traffic for either the website or the API, then maybe a separate server would be more suited.

like image 59
rogeriopvl Avatar answered Oct 12 '22 14:10

rogeriopvl