2

I'm currently working on a back end service which has a very crude interface for getting statistics and information about the service. I would like to deploy a lightweight web server for it to allow users to navigate to it's IP address and gather statistics and other information about the service. My back end service does a lot of video encoding and such, so I'd prefer something that wouldn't eat up too many CPU cycles.

Does anyone have some good suggestions for a web server like this and a light weight mechanism to communicate between the two. I've never implemented something like this but I have seen example where people have used things like tomcat and XML over local sockets to do this kind of thing. I just wanted to poll the community and see if there were any other suggestions out there.

anoneironaut
  • 1,778
  • 16
  • 28

3 Answers3

1

To add some web service into an existing C++ application, you could consider using some HTTP server libraries like Wt or perhaps libonion.

But you need to have some event loop in the application...

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
1

The approach you should select depends on what your choice of web server and 'normal' web server scripting/programming language is. Regardless, the worker/process which does heavy computation should be in C++. However, its wrapper scripting/programming language may be in something else like Java/Python etc.

You should start with looking at FastCGI. If you want to do 'everything' in C++, then consider Wt toolkit which implements FastCGI.

Another approach could be using Python/Django as invoking C++ from Python is easy.

How to use Django with FastCGI https://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/

FastCGI sample: http://forum.lighttpd.net/topic/79206

0

If you don't need 100% realtime or interactive statistics, you could just write them out into a text or HTML file in regular intervals and use a standard webserver (ngingx, Apache) to serve those.

Tomas Andrle
  • 13,132
  • 15
  • 75
  • 92