Closed pokal4u closed 11 years ago
Hi @pokal4u,
What kind of connections are you using? (eventsource, websocket, stream, long polling, ...) What client are you using? Are you using the pushstream.js?
The messages 1 and 4 are common to receive, but may be in a higher number due to your configuration. Mainly by using development mode (master_process and daemon as off) The other two are probably configuration issues.
Hi,
I am using longpooling connection and pushstream.js
Thanks Pokal
The default longpolling timeout on pushstream.js is 30s, if you do not have changed that value, you are using incompatible values between client (30s) and server (5m), use a value slightly bigger on client, like 60s on sever and 65s on client. With this adjust probably your error messages will decrease. And do not use development mode on production. ;)
Any news?
Hi, Thanks
I got same problem and I am using websocket.this is my conf
worker_processes 4;
error_log logs/error.log info;
pid logs/nginx.pid;
events { worker_connections 65535; }
http { include mime.types; default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent [$request_body] '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
log_escape_non_ascii off;
push_stream_shared_memory_size 1500M;
push_stream_max_channel_id_length 256;
push_stream_max_messages_stored_per_channel 5;
push_stream_message_ttl 24h;
lua_package_path "/data/openresty/lualib/resty/?.lua;;";
sendfile on;
#tcp_nopush on;
#keepalive_timeout 65;
#gzip on;
server {
listen 9080 default_server;
charset utf-8;
access_log logs/host.access.log main;
#lua_code_cache off;
location /ios_push{
lua_need_request_body on;
content_by_lua_file conf/memcached.lua;
}
location /android_push {
push_stream_publisher admin;
push_stream_channels_path $arg_id;
push_stream_store_messages on;
}
location ~ /ws/(.*) {
push_stream_subscriber websocket;
push_stream_channels_path $1;
push_stream_last_received_message_time "$arg_time";
push_stream_last_received_message_tag "$arg_tag";
push_stream_message_template "{\"id\":~id~,\"channel\":\"~channel~\",\"text\":~text~,\"tag\":~tag~,\"time\":\"~time~\"}";
push_stream_websocket_allow_publish on;
push_stream_ping_message_interval 180s;
push_stream_store_messages on;
}
location /channels-stats {
# activate channels statistics mode for this location
push_stream_channels_statistics;
# query string based channel id
push_stream_channels_path $arg_id;
}
}
}
and also I push about 500 messages/second to the location "/android_push"
What can I do for this situation ?Thanks
What is your exactly situation?
I used websocket to pull message and I got these 2 errors. 1,recv() failed (104: Connection reset by peer) 2,client closed prematurely connection while reading client request line
many users can't connect to " location ~ /ws/(.*)" and at the same time I used another to send push message to “ location /android_push ” and the speed is about 500 messages/second.
I think maybe it's too fast to push so many messages to the "location /android_push " and the connections of nginx are used up.
Am I clear?
@9992800 these messages are not produced by the module itself. Considering the scenario you have described I would say that the problem is a network/socket configuration at your server. You must tune socket buffers sizes and number of max open files to correspond to the number of worker connections that you are setting, specially if are starting the server as a "normal" user. Many of the OSs have a low value, like 128 or 1024 for max open files by default. There are some tutorials about these configurations and tunes for nginx.
Ok ,thanks very much ,I will try.thanks again
Hi, I got errors in error_log file like
4.client closed keep alive connection
This time get 500 internal server error
we are using ubuntu and my config file:
pid logs/nginx.pid; error_log logs/nginx-main_error.log debug;
Development Mode
master_process off; daemon off; worker_rlimit_core 500M; working_directory /tmp/nginx;
worker_processes 2; worker_rlimit_nofile 50000;
events { worker_connections 1024; use epoll; }
http {
server { listen 80 default_server;
server_name localhost;
.................... .......................... } } Please help me Pokal