Fastcpp -- C ++ Web Development Environment
Powered by apache2
JSP, ASP, Asp.net, PHP, Perl, Python, Ruby on Rails, FastCGI, and fastcpp.
Fastcpp is a C ++ web development environment better than Apache (currently only supports apache2). fastcpp can be used to quickly develop high-performance web applications and provide cookies, session also supports dynamic development and mixed HTML embedding.
Comparison with other web development languages.
Advantages:
1) Based on C ++, it supports powerful development libraries such as STL, boost, and Loki.
Fastcpp is not a new scripting language, but a C ++ pseudocode that supports mixed HTML embedding. Through the fastcpp translation function, fastcpp code is translated into C ++
Source file, and call G ++ to compile it into a dynamic link library. Therefore, you can directly use the C ++ syntax you are familiar with, use powerful STL, and directly use system calls.
More powerful library.
2). It can provide high-performance Web service capabilities.
Fastcpp is developed based on The apache2 module. The dynamic link library compiled from the pseudo files of fastcpp is directly used by the process. In terms of performance and write module
Same. Theoretically, the performance will be far above JSP, PHP, Perl, and FastCGI, because JSP, PHP, and Perl are executed by the script engine, while FastCGI uses
Fastcgid is used to maintain CGI, and the running result of CGI is transmitted to
Apache2, although FastCGI can use C language to increase the performance of the language itself, transmission through pipelines will become one of the bottlenecks of FastCGI.
Fastcpp has no obvious performance bottleneck, because the final program of fastcpp is part of The apache2 process and is directly transmitted within the process without transmitting data such as pipelines, therefore, it has more advantages than FastCGI.
3). fast development process.
You only need to configure apache2 and write the pseudo code of fastcpp in the web directory to directly access and get the result. fastcpp needs to be compiled during the first access, so the speed will be very slow, after the second access, no compilation is required. It has been combined with the main process of apache2 into a process.
Fastcpp supports HTML mixed embedding. You can edit fastcpp pages like HTML. In addition, the compilation parameter settings are provided, and the program can be developed according to the MVC concept,
4). Complete Function Support.
Fastcpp supports cookies and sessions. You can store the variables you need in the session and share them on two different pages.
Disadvantages:
1). Other development languages are not supported. Only C ++ languages are supported. The default compiler is g ++. ^
2). Affected by the process concept. Only the worker of single-process multi-thread of apache2 can work in multiple threads.
Because fastcpp depends on two global variables, pages and
Sessions is the page cache and Session Manager of fastcpp.
Multi-process: 1. apache2 fork a new process based on the load. pages and sessions between the two processes are two different units.
The uniqueness of sessions can be imagined, so only single-process can be selected. Fortunately, worker is the high performance recommended by apache2.
.
Perhaps fastcpp will provide a MPM with better functions and performance in the future.
3). fastcpp clusters are not supported for the moment. However, this function will be added in future development.
4). Currently, apache1.x is not supported.
5). It does not support operating systems other than Linux.
6 ). at present, fastcpp and apache2 are bound to the same process. Therefore, if the page memory access error occurs, The apache2 crash will occur directly, which is serious and risky. therefore, you must be careful when selecting fastcpp. However, I think it is easy to avoid these problems by making full use of the powerful functions of the C ++ language.
How to obtain and install fastcpp?
Fastcpp will support cross-platform in the future, but only Linux. Now, you can only use Linux to use fastcpp.
1. Obtain the source code.
Fastcpp is the Code published in compliance with GPL requirements.
Apache2. you need an apache2 source code, you can download in httpd.apache.org, I use the httpd-2.0.54
Fastcpp. In http://dragon.linux-vs.org /~ Jinti/fastcpp-0.0.1.tar.gz.
2. Installation
1) install apache2
Jinti @ heaven :~ $ Tar jxf httpd-2.0.54.tar.bz2
Jinti @ heaven :~ $ Httpd-2.0.54 CD
Jinti @ heaven :~ /Httpd-2.0.54 $./configure -- With-MPM = worker
Jinti @ heaven :~ Httpd-2.0.54 $ make & make install
2) install fastcpp
Jinti @ heaven :~ $ Tar jxf fastcpp-0.0.1.tar.gz
Jinti @ heaven :~ $ Fastcpp-0.0.1 CD
Jinti @ heaven :~ /Fastcpp-0.0.1 $./configure & make install
After fastcpp is installed, you must add
Loadmodule fastcpp_module modules/mod_fastcpp.so
Addhandler fastcpp-script. FC
In this way, you can call the fastcpp script with the extension. FC.
3. Run
Run apache2.
./Apachectl-done_process-K start
# Add-done_process. Otherwise, two sessionmaps images may be generated. This is incorrect.
Create a hello. FC under apache2/htdocs
Jinti @ heaven :~ $ Cat apache2/htdocs/Hello. FC
<% @ INC "-I/usr/include/" %>
<% @ Link "-l/usr/lib/" %>
<% @ Comp "-O2" %>
<%!
# Include <iostream>
Using namespace STD;
Static int I = 0;
%>
<HTML>
<Head>
<Title> thank you for choicing fastcpp </title>
</Head>
<Body>
<%
Page <"<B> hello, fastcpp" <I ++ <"<br> </B>" <Endl;
%>
</Body>
</Html>
Open your browser and access http: // 127.0.0.1/Hello. FC to see the running result.