The POCO C++ Libraries Blog


Filed under: Uncategorized by alex at 22:42

Thank God It’s Friday – a perfect time to relax and put out few thoughts about programming languages. Not surprisingly, I often come across as a language bigot, which I really am not. It’s not my fault that there’s so many lousy languages, and only one True One ;-). Just kidding – I actually wrote few Python lines of code a couple of years ago and – liked it.

Seriously, when I think a bit more about what is it exactly that ties me to C++, I concluded that the most important things are independence from any proprietary lock-in and low performance price paid for abstraction. Don’t get me wrong about lock-in – it’s not the money I’m against – I have no problem with people charging for software or related development/suport services, after all I am doing it myself. But I want my freedom to get out of it if I choose. When I see an attempt to cleverly lure, lock me in and then engage in extortion scheme knowing I have no choice but pay, I am out of there. I have recently attended a presentation about a major car manufacturing facility information system that is 100% MS VB. Presenter said the choice was smart because “things are really smooth and easy with VB”. My language bias aside, I could not help but wonder whether his opinion had anything to do with the fact that he is working for the contracting company supplying software development and maintenance services to the mentioned manufacturer – all viewed in the light of the fact that most of their recent income is generated because MS has desupported VB, so everything must be ported to VB.NET. I am truly grateful to the C++ standard body for paying so much attention to backward (and C) compatibility. Especially since they are not paid for it. And then, to be quite honest, I am also thankful (believe it or not) to – Microsoft. I think their support for C++ has helped a lot to keep C++ alive. Needless to say, they’ll have to look elsewhere for their proprietary extensions victim, though.
As I have mentioned already somewhere, I have been using Poco for about year and a half at work, in school and more (sometimes I really I think I need a life 😉 ). The more I use poco, the more I like it. I had no problem with it when it was not “free” and I personally did not see the big issue with eventually being required to pay for it if I’d want to venture into making money with it and deny the rest of the world to peek into my code. During this year and a half, I wrote 3 relatively small apps at work to see how does poco do in real world (steel manufacturing material tracking and process control) and they run as a charm – “set it and forget it” in its best – we are currently considering a major port of a significant portion of legacy code to Poco platform. I have also started two projects on my own time. These projects will be open sourced, well … soon (gotta go get a life first) – I’m currently waiting for 1.2 release to polish and actually launch the first project – dubbed Molto – a 2.4 Sun servlet specification compatible Poco-based container. Stay tuned …

  1. So you are workig on Tomcat ( killer, right? I have always wondered why there is nothing like Tomcat written in c++. I came across this attempt

    but it has been in beta for years and years. Also I believe RogueWave had something in the early 2000-1 but I have never heard of it since.

    I don’t know how much c++ is used in internet apps; I suspect not much ( apart from back end servers (DBMS, OS), but these are typically written in pure C).

    Comment by Tom Sayed on August 5, 2006, 13:18

  2. Tomcat killer? I should have named it Underdog ;-). I’ve been working on and using C++ servlets for a long time – we have an implementation at work (based on this DDJ article code: ) that actually runs in production, but never was made platform independent.
    There are other attempts out there, beside the ones you are mentioning, this one seems alive:

    At one point there was also an apache module attempt.

    RogueWave’s Bobcat became part of their LEIF enterprise framework. Lessons learned from implementing it are described in this article :

    You’re right, C++ is not widely used for internet apps and it is for several reasons:
    – C++ is not the easiest thing to deal with
    – C++ is not marketed by big corporations as a “langugage de jour”
    – there is an abundance of false information on C++ being produced by quasi-experts.
    So, is Molto a Tomcat killer? It’s way too early to tell. If it picks up, grows a solid developer base and proves itself in real world, maybe. But only time will tell.

    Comment by alex on August 5, 2006, 15:54

  3. I am curious to hear how a c++ based servlet container performs compared to a Java based server like Tomcat. The c++ version would most likey start up faster but would it necessarily run faster i.e serve content faster? If there is no significant speed advantage for c++ am afraid there won’t be much incentive for developers to toss out the Java based containers.

    One other consideration is the availability of the rest of infrustucture that go with web apps; database connections, authentication, encrytpion, load balancing, smtp, xml, web frameworks etc. etc. It is kind of daunting to develop all this stuff in c++ and have all the components play nice together.

    Am I being too pessimistic?

    Comment by Andy Morton on August 7, 2006, 02:39

  4. I’d say, yes, you are being too pessimistic. As far as prerformance, once the code is out, anyone can do tests. Right now, it would only be speculation because I have done no performance comparisons with Tomcat. Guenter has recently done some tests with Poco HttpServer, and on a 3GHz P4 running Windows Server 2003, the HTTP server (using the HTTPTimeServerExample with logging removed) is able to handle over 2000 connections per second, using 200 threads.

    About the infrastructure – most things you are mentioning are avilable in Poco – check the Net library. Molto comes with it’s own Poco webserver and plugin architecture allowing the use of alternate ones. Development of PocoData, (which will include databaase access) will start soon. There already are some proposals for SSL (Poco::Net_SSL exists, but it’s license was not “boostified”).

    Comment by alex on August 7, 2006, 13:24

  5. PocoData! Now that sounds really exciting. I assume this will be an abstraction layer for various DBMS’s like Perl DBI correct? There are some efforts in this regard; to name a few: ( mature and quite robust ) ( potentially boost bound )
    Or are you proposing a SQL engine written from ground up in modern c++. I am not aware of any such attempt at this. I hear Firebird was re-written in some sort of c++ other than that all engines seem to be written in C. Even relatively new ones such as SQLlite. But if people have written SQL engines in Java ( Clouds cape; Hibernate?? ) I guess one can write one in C++ as well.

    Comment by Larry Robin on August 9, 2006, 21:00

  6. Larry,

    PocoData, as I have proposed it, will be an abstraction layer for data (relational, XML and whatever else comes down our way). For relational data, it will support both native and ODBC access. The final interface design is currently brewing in Guenter’s head and AFAIK will be based on DBLite interface with inclusion of some good ideas from SOCI. I have no doubt that Guenter will do the job right, so let’s just recline and wait 😉


    Comment by alex on August 10, 2006, 12:34

  7. One reason for using C++ servlet container in favor of Java-based one is size. When running on a machine with low memory (think embedded), and with no hardware JVM implementation, 20-50M that software JVM takes just isn’t acceptable. At the same time CPPSERV with relatively complex application loaded takes about 2-4M or resident memory.
    As far as speed goes, I think simple comparison (i.e. taking helloworld kind of servlet) will show very little difference with JIT and all, but with complex applications, with little effort C++ servlets will give speed advantage.

    Comment by Ilya A. Volynets-Evenbakh on November 20, 2006, 20:14

RSS RSS feed for comments on this post. TrackBack URI

Leave a comment