1

I am working on a project to embed a web server written in C into a device. The requirement is that it should support web services (SOAP / JSON-RPC) and should be compatible with ARM processor. Any suggestions of specific products or where to look first?

Mahendra Liya
  • 12,912
  • 14
  • 88
  • 114
  • What OS? How much RAM do you have to work with? For 4MB ram + 1GB disk space (SD card) I've successfully used Debian Linux + Lighttpd. – slebetman Dec 07 '10 at 05:42
  • @slebetman: Thanks for your time. We plan to use Linux 2.6x and the RAM on the device is said to be 256 MB.. It would have ARM based processor.. – Mahendra Liya Dec 07 '10 at 06:04
  • Ah in that case you can use any webserver you like. SOAP/JSON-RPC processing is really more a function of whichever programming language and framework you choose to implement your service. I recommend lighttpd if you need low memory overhead (with 256MB you actually don't) and Apache2 or Nginx if you need high throughput for your CGI app. – slebetman Dec 07 '10 at 09:15

2 Answers2

1

If the device is really short on resources consider an embedded webserver library like Mongoose or libsoup (using GLib). However note that services like SOAP and XML parsing in general are pretty heavy on resources.

Steve-o
  • 12,678
  • 2
  • 41
  • 60
  • Thank you for your reply. Would like to ask whether you have any experience working with Mongoose, as I was considering it as a probable option. – Mahendra Liya Dec 07 '10 at 06:18
  • 1
    I had a look but really wanted something even smaller and portable, ended up with my own implementation ( http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/http.c ) – Steve-o Dec 07 '10 at 09:42
1

Given your description: Linux based platform with 256MB RAM, you can basically use any web server you like. 256MB RAM takes your device out of the typical embedded territory into server space.

Don't worry about ARM support too much because it is well supported by the Linux community. It is one of the architectures that is officially supported by Debian. I myself run a couple of web servers on ARM running Debian and lighttpd with hardware having only 32MB RAM.

The top three most popular web servers (and popularity is quite important since it means you can easily google if you have a problem):

  • lighttpd - very light on RAM usage since it is single threaded and very light on CPU usage as well. The disadvantage is that it can be slow to respond if you try to run heavyweight, CPU intensive CGI applications on it since it is single threaded.

  • Apache2 - heavy on RAM usage. Apache's default operating mode is to keep threads alive as long as possible to handle heavy loads. This means most of the time you use up RAM on sleeping processes. But if you DO need to handle heavy loads this is a good thing. Good for heavy duty CGI apps.

  • Nginx - the new kid on the block. Not as well documented (at the moment, obviously documentation improves with time) as either lighttpd or Apache but people have been saying that it outperforms both. It is multithreaded like Apache2 but nonblocking like lighttpd so it has the best of both worlds: it uses less RAM that Apache2 (though more than lighttpd) in general and performs at least as well if not better than Apache2 under load. The only real downside for me is the documentation.

slebetman
  • 109,858
  • 19
  • 140
  • 171