user656925
user656925

Reputation:

Design Considerations - C++ Server Development

I want to convert my web application prototype (PHP server side) to a C++ solution. This has already been decided. I've been on Wikipedia, Google, and SO to determine the best way to to this.

I've already decided on Linux and Apache (or custom server).

What I think I've learned is that this can be done multiple ways. In order of the speed or efficiency you will get.

  1. Write the Server
  2. Write an Apache Module
  3. Write it to use Fast CGI
  4. Write it to use CGI

I have about 1400 lines of PHP so my web app is small. I also know that CS courses in web typically have the students write a basic web server as lab. Fast CGI claims to be faster than CGI as the name implies..and I've heard that a module is fastest as it has a tighter integration with Apache. Writing your own server would probably be the fastest as it would be application specific instead of all purpose.

I'm trying to put together a project I can finish in under a year and keep the code base under 6000 lines or so.

What is the fastest way to do this that is reasonable?

Related SO Posts

C++ Web Libraries

Similar SO

Upvotes: 2

Views: 754

Answers (4)

stronglytyped
stronglytyped

Reputation: 1

I have to agree with one of the commenters. C++ might not be the best choice, and you should probably get your work done more quickly using Opa or similar languages.

Upvotes: -1

Artyom
Artyom

Reputation: 31271

I'd strongly recommend to go with CppCMS.

  1. FastCGI support (and not FastCGI only)
  2. It was designed for performance in the first place.
  3. All tools needed for web development.
  4. The technology is already proven as high performance technology and that is already used on numerous web sites.

Disclosure: I'm the author of CppCMS

Small notes:

Write the Server

Why there are plenty good web servers that do the job well.

Write an Apache Module

You become tied to specific technology

Write it to use Fast CGI

This is the best approach as it web server independent and designed to run the user applications.

Write it to use CGI

CGI is good for small, rarely executed tasks. Not for high performance applications.


Note: web development is quite complex task, so using framework helps you to work on your business logic rather then dealing with small details

Upvotes: 1

Nemanja Trifunovic
Nemanja Trifunovic

Reputation: 24561

I'd start with a FastCGI handler on nginx - it is really fast and CGI is a very stable API. Writing your own server may be a nice learning experience, but I am not sure you'd be able to make it nearly as performant as nginx or Apache.

Upvotes: 2

sanjivr
sanjivr

Reputation: 1001

I don't have sufficient privileges to comment on a question, so putting my comment as an answer.

Considering that you've already built the prototype in php and if you're concerned about php's runtime performance, use hiphop for php! while deploying. Developing an apache module in c/c++ has quite a steep learning curve.

Upvotes: 2

Related Questions