Search code examples
c++mysqlcgimysql++

C++ CGI and MySQL problem (mysql++)


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


Solution

  • 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.