views:

220

answers:

2

Hi

I'm trying to use c++ in cgi programs and everything is ok if i don't use mysql. Without mysql my site is generated in about 1-2 ms, but if I add only one variable or function from mysql++ library, site is generated in ~35 ms! (with php it's about 15 - 25 ms all time) I suppose it's a problem with dll loading ( there are two, and mysql dll is about 2 MB! ). So, how can I use mysql without such performance decrease?

Chris

+1  A: 

Maybe you could have a look fastcgi, the aim of fastcgi is to prevent from having to launch the executable for each request, the executable is always running and each request is transmitted through a socket to your cgi. fastcgi provides a library to easily do this in several languages. You then have to configure your web server, for example mod_fastcgi for Apache.

Etienne PIERRE
I tried to use fastcgi, but it's not a solution for me. I decided to write my own server, it's not so hard as I thought :)
chris
+1  A: 

CAREFUL

beacuse of license (LGPL) - if I don't want to share my code I have to link dynamically – chris Jun 19 at 14:05

Please take a look at this discussion:
http://stackoverflow.com/questions/1260591/about-mysql-gpl-and-lgpl
In case you don't release your compiled binaries, is ok, but if you want to release your binaries you will have to release the sources as well due to the fact MySQL++ is based on a GPL library (the mysql C connector).
Or buy the commecrial license.

Cheers,