Comments (3)
Can you post a reproducible test case?
from hyperfastcgi.
- All actions tested in clean Ubuntu 14.04.4.
- Download a database dump:
wget https://www.dropbox.com/s/6tkw43o97ptoblk/forum.tar.gz?dl=0
. - Extract the dump:
tar -xzf forum.tar.gz
. - Install MySQL:
sudo apt-get install mysql-server mysql-client
. - Create a database and an user:
mysql -u root -p
create database forum;
create user 'admin'@'localhost' identified by 'admin';
grant all privileges on forum.* to 'admin'@'localhost';
exit
- Restore a database from the dump (long running operation, about 20-30 mins):
mysql -u root -p forum < forum.sql
- Install mono, git and HyperFastCgi:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get install mono-complete
sudo apt-get install git
git clone https://github.com/xplicit/HyperFastCgi.githyperfastcgi4 `--config=server.config`
sudo apt-get install autoconf automake libtool make libglib2.0-dev libevent-dev
cd HyperFastCgi/
./autogen.sh --prefix=/usr
make
sudo make install
- Clone my project and build:
git clone https://github.com/Ustimov/Forums.git
cd Forums/
sudo apt-get install nuget
nuget restore
xbuild /p:Configuration=Release
- Install nginx:
sudo apt-get install nginx
- Configure nginx and HyperFastCgi:
create file
sudo nano /etc/nginx/sites-available/forum
and past (set paths according to your environment):
upstream fastcgi_backend {
server 127.0.0.1:9000;
keepalive 32;
}
server {
listen 8000;
server_name localhost:8000;
error_log /var/log/nginx/Forum.Error.log;
location / {
root /root/Forums/Forum/;
index index.html index.htm default.aspx Default.aspx;
fastcgi_index Default.aspx;
fastcgi_keep_conn on;
fastcgi_pass fastcgi_backend;
include /etc/nginx/fastcgi_params;
}
}
create symlink to forum file
rm /etc/nginx/sites-enabled/default
ln -s /etc/nginx/sites-available/forum /etc/nginx/sites-enabled/forum
sudo service nginx restart
create server.config with this content (set paths according to your environment):
<configuration>
<server type="HyperFastCgi.ApplicationServers.SimpleApplicationServer">
<!-- Host factory defines how host will be created. SystemWebHostFactory creates host in AppDomain in standard ASP.NET way -->
<host-factory>HyperFastCgi.HostFactories.SystemWebHostFactory</host-factory>
<!-- <threads> creates threads at startup. Value "0" means default value -->
<threads min-worker="40" max-worker="0" min-io="4" max-io="0" />
<!--- Sets the application host root directory -->
<!-- <root-dir>/path/to/your/dir</root-dir> -->
</server>
<listener type="HyperFastCgi.Listeners.NativeListener">
<apphost-transport type="HyperFastCgi.Transports.NativeTransport">
<multithreading>Single</multithreading>
</apphost-transport>
<protocol>InterNetwork</protocol>
<address>127.0.0.1</address>
<port>9000</port>
</listener>
<apphost type="HyperFastCgi.AppHosts.AspNet.AspNetApplicationHost">
<log level="Debug" write-to-console="true" />
<add-trailing-slash>false</add-trailing-slash>
</apphost>
<web-applications>
<web-application>
<name>Forum</name>
<vhost>0.0.0.0</vhost>
<vport>8000</vport>
<vpath>/</vpath>
<path>/root/Forums/Forum/</path>
</web-application>
</web-applications>
</configuration>
- Run application:
hyperfastcgi4 --config=server.config - Clone tests:
git clone https://github.com/s-stupnikov/technopark-db-api.git
cd technopark-db-api/tests/
nano perf_test.py
change CONFIG_PATH = '/usr/local/etc/test.conf' to CONFIG_PATH = '../conf/test.conf'
- Download a test scenario:
wget https://www.dropbox.com/s/eg5o1edz8y216j7/ustimov_httperf_scenario?dl=0
. - Install httperf and run tests:
sudo apt-get install httperf
httperf --hog --client=0/1 --server=127.0.0.1 --port=8000 --uri=/ --send-buffer=4096 --recv-buffer=16384 --add-header='Content-Type:application/json\n' --wsesslog=100,0.000,ustimov_httperf_scenario
P.S. With clean installation I doesn't get the same error (I use Debian before), but now I've get:
2016/06/04 14:00:25 [error] 1633#0: *77 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: localhost:8000, request: "GET /db/api/user/listPosts?limit=29&user=amizy%40ua.ru&order=asc HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"
2016/06/04 14:00:25 [error] 1633#0: *79 upstream sent too big header while reading response header from upstream, client: 127.0.0.1, server: localhost:8000, request: "GET /db/api/forum/listPosts?related=forum&related=thread&limit=25&order=asc&forum=1lnro HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"
from hyperfastcgi.
"too big header" error message is unrelated to the error described in header of the issue and is expected behaviour of nginx.
Nginx has limitation of size for fast_cgi response headers, so if you want to send big headers in responses from your application you should increase these limits. There are settings fastcgi_buffer_size
and fastcgi_buffers
, for example.
fastcgi_buffer_size 512k;
fastcgi_buffers 512 4k;
The numbers in sample are pretty huge, so for real application you should tweak them to your needs. Here is an simple case how to tweak buffers: https://easyengine.io/tutorials/nginx/tweaking-fastcgi-buffers/
The second point that in your case you try to perform two mutually exclusive operations: profile the service and compute a performance. If you want to check performance of the service, you should disable MiniProfiler
by commenting two lines here
https://github.com/Ustimov/Forums/blob/master/Forum/Global.asax.cs#L54
https://github.com/Ustimov/Forums/blob/master/Forum/Global.asax.cs#L59
because at every request mini profiler adds some info to the headers and after large number of requests headers become several megabytes in size. Measuring performance of few-bytes body content with megabyte headers does not make sense.
If you want to profile the service to see the bottlenecks then run limited number of requests and analyze data returned by ServiceStack.
If you meet "Sent unsupported FastCGI protocol version" again, please feel free and open new issue.
from hyperfastcgi.
Related Issues (20)
- Seeing requests with about 46k of request body data fail with 502 under mono-server-hyperfastcgi4 HOT 3
- Will HyperFastCgi support .NET Core (ASP .NET 5)? HOT 1
- hyperfastcgi stop working but not crash HOT 11
- Trying to test NativeTransport and getting DllNotFoundException HOT 12
- compile agains mono 4.8.0 fail HOT 4
- 502 with Nginx HOT 5
- segfault after interrupting hung process with /stoppable=true HOT 2
- Weird Exception while initOnce HOT 1
- Similar issue with #67, 502 after 50k requests HOT 4
- Hyperfastcgi crashing HOT 4
- HyperFastCgi crashes if there is nothing in the webapp folder HOT 1
- configfile difficult to use HOT 1
- fcgi-transport.c:444: parse_params(): Can't find app! HOST='my.host' port=443 path='/index.aspx' HOT 4
- How can I set the umask for the process?
- No package 'mono-2' found, хотя mono установлен HOT 1
- Configuration location for ApplicationPoolRecycling HOT 2
- Error calling 'bufferevent_free' twice in NativeTransport on request end
- Probably race condition? HOT 1
- hyperfastcgi in nginx default server
- Managed Listener leaks sockets
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hyperfastcgi.