views:

91

answers:

3

Briefly, I need to create a server whose back end queries information from another server. I'm wondering how others might approach this problem.

Here's a longer description of the problem: I need to create a server (call this server Alpha) that makes requests to another server (call this server Omega) based on web pages that are requested by the client. The requests are network messages and are not SQL queries. The requested information will be part of the content that gets served to Alpha's clients. For example, the client might want to display a buddy list. Alpha would query Omega for the client's buddy list. Alpha then displays a web page with the buddy list.

The clients cannot connect directly to Omega. The server Alpha pretty much just handles client connections, manages queries from the client to the Omega server and serves new web pages (which could contain information queried from Omega).

I'm new to web development. I don't know much about Apache modules. But, it seems like most of the functionality is already available within Apache. It seems like Apache could be extended for sending the network messages that query information from the other server, Omega. Another option is to create the Alpha server from scratch.

Which approach would you use? Is there another approach that is better?

+1  A: 

Sounds like you want either a reverse proxy, or application server. You're a bit vague about what kind of data Omega is actually returning -- if you want Omega to generate web pages, then look into reverse proxies. Apache has a built-in proxy module, but I've heard that Squid has better performance:

If Alpha and Omega are using a custom protocol, then you'll want to treat Omega as an application server.

John Millikin
The data returned from Omega includes buddy list and user profile information. Omega will not generate web pages. Alpha will use the data from Omega and include it in web pages that are served to the client.
zooropa
+2  A: 

Without having more detail about what you're doing, it sounds like either of these approaches would be overkill. If I were doing buddy list querying in a modern Web programming environment, I would consider something like the following:

  • Server Alpha is my normal Web stack: Apache, my app server (i.e. Passenger for Rails, or something like JBoss for Java, etc.).
  • Server Omega is apparently already existing, so I won't address it. If it's not existing, it could be another server configured like Alpha.

Given that:

  • Web requests from users come to Alpha via the www.
  • My Web app on Alpha connects to Omega via the appropriate protocol. This might be XMPP to query a Jabber server, or LDAP, or whatever. Omega returns its results.
  • Web app on Alpha uses these results to build a page to return to the user.
runako
You're right. Omega already exists.
zooropa
Omega is a custom server that doesn't use http. Omega has its own protocol.
zooropa
+1  A: 

From the sound of it, it's the kind of system that would be served by a fairly ordinary scripted webpage. Using, for example, PHP the script calls the back-end web-service and produces a webpage with the information. How much processing is required, depends on the difference between the output from Omega and what you want the HTML to look like.

An Apache module seems to be overcomplicated - and a whole new server complete overkill.

Alister Bulman