Commit 84b87d59 authored by Wandenberg's avatar Wandenberg

removed push_stream_keepalive directive, let Nginx decide when to use...

removed push_stream_keepalive directive, let Nginx decide when to use keepalive and how many requests accept using keepalive_* directives
parent 781c16b7
h1(#changelog). Changelog
* Removed push_stream_keepalive directive, let Nginx decide when to use keepalive and how many requests accept using keepalive_* directives
* Removed push_stream_shared_memory_cleanup_objects_ttl directive
* Changed push_stream_websocket directive to be a subtype of push_stream_subscriber directive
* Changed push_stream_eventsource_support directive to be a subtype of push_stream_subscriber directive
......
......@@ -134,7 +134,6 @@ h1(#directives). Directives
| "push_stream_allowed_origins":push_stream_allowed_origins |   - |   - |   x |   - |   - |   - |
| "push_stream_websocket_allow_publish":push_stream_websocket_allow_publish |   - |   - |   - |   - |   - |   x |
| "push_stream_store_messages":push_stream_store_messages |   - |   - |   - |   x |   - |   x |
| "push_stream_keepalive":push_stream_keepalive |   - |   - |   - |   x |   x |   - |
| "push_stream_channel_info_on_publish":push_stream_channel_info_on_publish |   - |   - |   - |   x |   - |   - |
h1(#installation). Installation <a name="installation" href="#">&nbsp;</a>
......@@ -237,7 +236,6 @@ h1(#contributors). Contributors
[push_stream_user_agent]https://github.com/wandenberg/nginx-push-stream-module/blob/master/docs/directives/subscribers.textile#push_stream_user_agent
[push_stream_padding_by_user_agent]https://github.com/wandenberg/nginx-push-stream-module/blob/master/docs/directives/subscribers.textile#push_stream_padding_by_user_agent
[push_stream_store_messages]https://github.com/wandenberg/nginx-push-stream-module/blob/master/docs/directives/publishers.textile#push_stream_store_messages
[push_stream_keepalive]https://github.com/wandenberg/nginx-push-stream-module/blob/master/docs/directives/publishers.textile#push_stream_keepalive
[push_stream_channel_info_on_publish]https://github.com/wandenberg/nginx-push-stream-module/blob/master/docs/directives/publishers.textile#push_stream_channel_info_on_publish
[push_stream_allowed_origins]https://github.com/wandenberg/nginx-push-stream-module/blob/master/docs/directives/subscribers.textile#push_stream_allowed_origins
[push_stream_websocket_allow_publish]https://github.com/wandenberg/nginx-push-stream-module/blob/master/docs/directives/subscribers.textile#push_stream_websocket_allow_publish
......@@ -62,18 +62,6 @@ h2(#push_stream_store_messages). push_stream_store_messages <a name="push_stream
Whether or not message queuing is enabled.
h2(#push_stream_keepalive). push_stream_keepalive <a name="push_stream_keepalive" href="#">&nbsp;</a>
*syntax:* _push_stream_keepalive on | off_
*default:* _off_
*context:* _location (push_stream_publisher, push_stream_channels_statistics)_
*release version:* _0.2.4_
Enable keepalive connections, on publisher or channels statistics locations.
h2(#push_stream_channel_info_on_publish). push_stream_channel_info_on_publish <a name="push_stream_channel_info_on_publish" href="#">&nbsp;</a>
*syntax:* _push_stream_channel_info_on_publish on | off_
......
......@@ -76,7 +76,6 @@ typedef struct {
ngx_str_t footer_template;
ngx_str_t content_type;
ngx_uint_t broadcast_channel_max_qtd;
ngx_uint_t keepalive;
ngx_uint_t location_type;
ngx_msec_t ping_message_interval;
ngx_msec_t subscriber_connection_ttl;
......
......@@ -83,8 +83,6 @@ http {
# store messages in memory
push_stream_store_messages off;
push_stream_keepalive on;
# Message size limit
# client_max_body_size MUST be equal to client_body_buffer_size or
# you will be sorry.
......
......@@ -356,7 +356,7 @@ shared_examples_for "statistics location" do
body = 'body'
number_of_channels = 20000
nginx_run_server(config.merge(:shared_memory_size => '200m', :keepalive => "on"), :timeout => 15) do |conf|
nginx_run_server(config.merge(:shared_memory_size => '200m', :keepalive_requests => 1000), :timeout => 15) do |conf|
#create channels
0.step(number_of_channels - 1, 1000) do |i|
socket = open_socket(nginx_host, nginx_port)
......@@ -501,7 +501,7 @@ shared_examples_for "statistics location" do
body = 'body'
number_of_channels = 20000
nginx_run_server(config.merge(:shared_memory_size => '200m', :keepalive => "on"), :timeout => 15) do |conf|
nginx_run_server(config.merge(:shared_memory_size => '200m', :keepalive_requests => 1000), :timeout => 15) do |conf|
#create channels
0.step(number_of_channels - 1, 1000) do |i|
socket = open_socket(nginx_host, nginx_port)
......
......@@ -4,7 +4,7 @@ describe "Keepalive" do
let(:config) do
{
:shared_memory_size => '256m',
:keepalive => "on",
:keepalive_requests => 500,
:header_template => '',
:message_template => '~text~',
:footer_template => ''
......
......@@ -6,7 +6,7 @@ describe "Measure Memory" do
:shared_memory_size => "2m",
:message_ttl => "60m",
:max_messages_stored_per_channel => nil,
:keepalive => "on",
:keepalive_requests => 15000,
:header_template => nil,
:message_template => nil,
:footer_template => nil,
......@@ -26,7 +26,7 @@ describe "Measure Memory" do
nginx_run_server(config) do |conf|
shared_size = conf.shared_memory_size.to_i * 1024 * 1024
post_channel_message = "POST /pub?id=#{channel} HTTP/1.0\r\nContent-Length: #{body.size}\r\n\r\n#{body}"
post_channel_message = "POST /pub?id=#{channel} HTTP/1.1\r\nHost: localhost\r\nContent-Length: #{body.size}\r\n\r\n#{body}"
socket = open_socket(nginx_host, nginx_port)
while (true) do
......@@ -60,7 +60,7 @@ describe "Measure Memory" do
channel = 1000
while (true) do
post_channel_message = "POST /pub?id=#{channel} HTTP/1.0\r\nContent-Length: #{body.size}\r\n\r\n#{body}"
post_channel_message = "POST /pub?id=#{channel} HTTP/1.1\r\nHost: localhost\r\nContent-Length: #{body.size}\r\n\r\n#{body}"
socket.print(post_channel_message)
resp_headers, resp_body = read_response_on_socket(socket, {:wait_for => "}\r\n"})
break unless resp_headers.match(/200 OK/)
......
......@@ -9,7 +9,7 @@ module NginxConfiguration
:content_type => 'text/html',
:keepalive => 'off',
:keepalive_requests => nil,
:ping_message_interval => '10s',
:header_template => %{<html><head><meta http-equiv=\\"Content-Type\\" content=\\"text/html; charset=utf-8\\">\\r\\n<meta http-equiv=\\"Cache-Control\\" content=\\"no-store\\">\\r\\n<meta http-equiv=\\"Cache-Control\\" content=\\"no-cache\\">\\r\\n<meta http-equiv=\\"Expires\\" content=\\"Thu, 1 Jan 1970 00:00:00 GMT\\">\\r\\n<script type=\\"text/javascript\\">\\r\\nwindow.onError = null;\\r\\ndocument.domain = \\'<%= nginx_host %>\\';\\r\\nparent.PushStream.register(this);\\r\\n</script>\\r\\n</head>\\r\\n<body onload=\\"try { parent.PushStream.reset(this) } catch (e) {}\\">},
:message_template => "<script>p(~id~,'~channel~','~text~');</script>",
......@@ -92,6 +92,7 @@ http {
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 100;
<%= write_directive("keepalive_requests", keepalive_requests) %>
send_timeout 10;
client_body_timeout 10;
client_header_timeout 10;
......@@ -151,8 +152,6 @@ http {
# query string based channel id
<%= write_directive("push_stream_channel_id", channel_id) %>
<%= write_directive("push_stream_keepalive", keepalive, "keepalive") %>
}
location /pub {
......@@ -162,7 +161,6 @@ http {
# query string based channel id
<%= write_directive("push_stream_channel_id", channel_id) %>
<%= write_directive("push_stream_store_messages", store_messages, "store messages") %>
<%= write_directive("push_stream_keepalive", keepalive, "keepalive") %>
<%= write_directive("push_stream_channel_info_on_publish", channel_info_on_publish, "channel_info_on_publish") %>
# client_max_body_size MUST be equal to client_body_buffer_size or
......@@ -178,7 +176,6 @@ http {
# positional channel path
<%= write_directive("push_stream_channels_path", channels_path) %>
<%= write_directive("push_stream_content_type", content_type, "content-type") %>
<%= write_directive("push_stream_keepalive", keepalive, "keepalive") %>
}
<%= extra_location %>
......
......@@ -117,7 +117,7 @@ describe "Publisher Publishing Messages" do
messagens_to_publish = 1500
response = ""
nginx_run_server(config.merge(:max_reserved_memory => "256m", :keepalive => "on")) do |conf|
nginx_run_server(config.merge(:max_reserved_memory => "256m", :keepalive_requests => 500)) do |conf|
EventMachine.run do
sub = EventMachine::HttpRequest.new(nginx_address + '/sub/' + channel.to_s).get :head => headers
sub.stream do |chunk|
......
......@@ -67,7 +67,6 @@ http {
push_stream_publisher admin;
push_stream_channel_id $arg_id;
push_stream_store_messages off;
push_stream_keepalive on;
}
location ~ /sub/(.*) {
......
......@@ -36,7 +36,6 @@ ngx_http_push_stream_publisher_handler(ngx_http_request_t *r)
ngx_http_push_stream_channel_t *channel = NULL;
ngx_http_push_stream_loc_conf_t *cf = ngx_http_get_module_loc_conf(r, ngx_http_push_stream_module);
r->keepalive = cf->keepalive;
ngx_http_push_stream_set_expires(r, NGX_HTTP_PUSH_STREAM_EXPIRES_EPOCH, 0);
if (cf->allowed_origins.len > 0) {
......@@ -279,7 +278,6 @@ ngx_http_push_stream_channels_statistics_handler(ngx_http_request_t *r)
ngx_http_push_stream_channel_t *channel = NULL;
ngx_http_push_stream_loc_conf_t *cf = ngx_http_get_module_loc_conf(r, ngx_http_push_stream_module);
r->keepalive = cf->keepalive;
ngx_http_push_stream_set_expires(r, NGX_HTTP_PUSH_STREAM_EXPIRES_EPOCH, 0);
// only accept GET method
......
......@@ -176,12 +176,6 @@ static ngx_command_t ngx_http_push_stream_commands[] = {
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_push_stream_loc_conf_t, broadcast_channel_max_qtd),
NULL },
{ ngx_string("push_stream_keepalive"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_flag_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_push_stream_loc_conf_t, keepalive),
NULL },
{ ngx_string("push_stream_ping_message_interval"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_msec_slot,
......@@ -527,7 +521,6 @@ ngx_http_push_stream_create_loc_conf(ngx_conf_t *cf)
lcf->footer_template.data = NULL;
lcf->content_type.data = NULL;
lcf->broadcast_channel_max_qtd = NGX_CONF_UNSET_UINT;
lcf->keepalive = NGX_CONF_UNSET_UINT;
lcf->location_type = NGX_CONF_UNSET_UINT;
lcf->ping_message_interval = NGX_CONF_UNSET_MSEC;
lcf->subscriber_connection_ttl = NGX_CONF_UNSET_MSEC;
......@@ -557,7 +550,6 @@ ngx_http_push_stream_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_str_value(conf->footer_template, prev->footer_template, NGX_HTTP_PUSH_STREAM_DEFAULT_FOOTER_TEMPLATE);
ngx_conf_merge_str_value(conf->content_type, prev->content_type, NGX_HTTP_PUSH_STREAM_DEFAULT_CONTENT_TYPE);
ngx_conf_merge_uint_value(conf->broadcast_channel_max_qtd, prev->broadcast_channel_max_qtd, ngx_http_push_stream_module_main_conf->max_number_of_broadcast_channels);
ngx_conf_merge_uint_value(conf->keepalive, prev->keepalive, 0);
ngx_conf_merge_msec_value(conf->ping_message_interval, prev->ping_message_interval, NGX_CONF_UNSET_MSEC);
ngx_conf_merge_msec_value(conf->subscriber_connection_ttl, prev->subscriber_connection_ttl, NGX_CONF_UNSET_MSEC);
ngx_conf_merge_msec_value(conf->longpolling_connection_ttl, prev->longpolling_connection_ttl, conf->subscriber_connection_ttl);
......
......@@ -59,8 +59,6 @@ ngx_http_push_stream_subscriber_handler(ngx_http_request_t *r)
ngx_http_push_stream_add_response_header(r, &NGX_HTTP_PUSH_STREAM_HEADER_ACCESS_CONTROL_ALLOW_HEADERS, &NGX_HTTP_PUSH_STREAM_ALLOWED_HEADERS);
}
r->keepalive = cf->keepalive;
if (r->method & NGX_HTTP_OPTIONS) {
return ngx_http_push_stream_send_only_header_response(r, NGX_HTTP_OK, NULL);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment