9

I'm looking into developing a web application hosted on Amazon Web Services and I have a question regarding it's architecture.

Looking at the diagram below from Amazon, they've got 3 layers; a web server serving users via HTTP, an application server processing business logic, and a database server. This is perfect for our use and the separation of web and application logic is great, however I have a question regarding the communication between the layers.

The app's code is going to be written in PHP. The communication between the application server and the database server can be done by PHP's mysqli extension (to the host db server via port 3306 by default). This is fine, however I'm unsure how communication would be made between the web server and the application server during a user's HTTP request, and what the best way of doing it is.

I've read up about XML/RPC, or possibly JSON/RPC, but is this the right thing that I'm looking for? Or is communication between different PHP server layers usually done another way?

Any advice would be greatly appreciated.

Recommended AWS Web App Architecture

Steve
  • 2,526
  • 2
  • 20
  • 30
  • 1
    Just making sure you realize that the diagram shows conceptual architecture - there's nothing forcing you to use it. EC2 is just infrastructure and in principle you could combine the application and web layers. – Elad Apr 10 '11 at 13:33

3 Answers3

2

There's a big chance the interfaces you have to develop for your application layer will be different for several apps. One way to have a generic approach for this is building more abstraction.

It can be implemented in a lot of ways, in PHP or maybe some other technology in between. You could read up about Webservices (WSDL, SOAP, WSO2.org PHP-specific), REST, RPC-style (you mentoined it), RMI (Java), Corba, JAXB, several project from the Apache Foundation, Google's protocol buffers, or implement your own protocol; Staging databases could also be a helping hand in some cases.

I think your question is too general to really "answer" it. It's one of the first questions you'd have to answer when setting up an architecture like this.

Robert de W
  • 316
  • 8
  • 24
2

If you are using PHP as the backed then you are most likely going to have your webservers and "application" servers on the same machine (Apache + php) so the diagram from amazon doesn't really apply in this case. One thing that you may want to look into is putting a machine in front of your webservers (nginx or the like) to reverse proxy the requests back to your webservers, or maybe look into ELB from amazon.

Matt
  • 450
  • 1
  • 4
  • 11
0

You could also consider REST which uses http for communication between the web layer and app layer.

Josnidhin
  • 12,469
  • 9
  • 42
  • 61
  • Does Amazon EC2 support REST? – Rudie Apr 25 '11 at 00:09
  • An app on ec2 can support REST after all it a web server – Josnidhin Apr 25 '11 at 02:45
  • A decent REST server would accept, understand and evaluate all HTTP methods incl PUT, DELETE, TRACE etc. Not all webservers do that. Amazon's might. I wouldn't be surprised. – Rudie Apr 25 '11 at 02:52
  • EC2 by iteself is just a linux/window machine. The user has to to install and configure whatever necessary for his application including webserver/app server, libs etc. – Josnidhin Apr 25 '11 at 03:28
  • You can set up the server yourself? Didn't know that of EC2. Maybe mixed up with SE3 or FE4 or something. (They name all their services like that.) My bad. – Rudie Apr 25 '11 at 03:31