You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2014/01/02 23:36:02 UTC
[1/4] git commit: TS-1365 Fix doc for --poll_timeout
Updated Branches:
refs/heads/master 52c2da6ed -> f78c83a82
TS-1365 Fix doc for --poll_timeout
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/037d8cc2
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/037d8cc2
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/037d8cc2
Branch: refs/heads/master
Commit: 037d8cc2c54e6ddbd83dc95f055d8756c078a6ca
Parents: a74ef5a
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu Jan 2 15:22:18 2014 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Jan 2 15:30:53 2014 -0700
----------------------------------------------------------------------
doc/reference/commands/traffic_server.en.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/037d8cc2/doc/reference/commands/traffic_server.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/commands/traffic_server.en.rst b/doc/reference/commands/traffic_server.en.rst
index 442a369..2c8b586 100644
--- a/doc/reference/commands/traffic_server.en.rst
+++ b/doc/reference/commands/traffic_server.en.rst
@@ -62,7 +62,7 @@ Description
.. option:: --accept_mss MSS
-.. option:: -t SECS, --poll_timeout SECS
+.. option:: -t MSECS, --poll_timeout MSECS
.. option:: -h, --help
[4/4] git commit: Added TS-1365 to CHANGES,
fixed default config value in docs
Posted by zw...@apache.org.
Added TS-1365 to CHANGES, fixed default config value in docs
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/f78c83a8
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/f78c83a8
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/f78c83a8
Branch: refs/heads/master
Commit: f78c83a82d6eb6f2bfc23fc86ceb430121548049
Parents: 037d8cc
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu Jan 2 15:33:47 2014 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Jan 2 15:33:47 2014 -0700
----------------------------------------------------------------------
CHANGES | 6 ++++++
doc/reference/configuration/records.config.en.rst | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f78c83a8/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 6d01fca..7e4ae1e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,12 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 4.2.0
+ *) [TS-1365] Add a new configuration option, proxy.config.net.poll_timeout,
+ with the same behavior as the command line option --poll_timeout. Also
+ adjust AIO scheduling to correlate to this setting, to avoid additional
+ CPU load. Note that this configuration is generally not necessary to
+ configure, unless you are concerned with system idle CPU consumption.
+
*) [TS-2468] Bring back the load balancer plugin.
*) [TS-2465] libxml2 detection generates an invalid linker path.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/f78c83a8/doc/reference/configuration/records.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/records.config.en.rst b/doc/reference/configuration/records.config.en.rst
index 08aaf1a..79e4975 100644
--- a/doc/reference/configuration/records.config.en.rst
+++ b/doc/reference/configuration/records.config.en.rst
@@ -2225,7 +2225,7 @@ Sockets
Same as the command line option ``--accept_mss`` that sets the MSS for all incoming requests.
-.. ts:cv:: CONFIG proxy.config.net.poll_timeout INT 0
+.. ts:cv:: CONFIG proxy.config.net.poll_timeout INT 10 (or 30 on Solaris)
Same as the command line option ``--poll_timeout``, or ``-t``, which
specifies the timeout used for the polling mechanism used. This timeout is
Re: [2/4] git commit: TS-1365 Update documentation
Posted by Theo Schlossnagle <je...@lethargy.org>.
You can change it to 10ms. However, if we’re reliably using net_signal_hook_function to wake up the event thread, it’s not very relevant as that will immediately cause a return. Consistency is valuable, I’m +1 on changing it to 10ms.
--
Theo Schlossnagle
http://lethargy.org/~jesus/
On Friday, January 3, 2014 at 12:13 PM, Leif Hedstrom wrote:
> On Jan 2, 2014, at 5:03 PM, Igor Galić <i.galic@brainsware.org (mailto:i.galic@brainsware.org)> wrote:
>
> >
> >
> > > + ``epoll_wait()``. The default value is ``10`` on all platforms except
> > > + Solaris, where it is ``30``.
> > >
> >
> >
> > *Why* is it different on Solaris?
>
>
> Fine question. I don’t know. Theo or anyone else using Solaris: Why would we want the timeout to kevent() to be 30ms instead of 10ms as we do for Linux? Can / should we change it to 10ms across the board?
>
> — Leif
Re: [2/4] git commit: TS-1365 Update documentation
Posted by Leif Hedstrom <zw...@apache.org>.
On Jan 2, 2014, at 5:03 PM, Igor Galić <i....@brainsware.org> wrote:
>
>
>> + ``epoll_wait()``. The default value is ``10`` on all platforms except
>> + Solaris, where it is ``30``.
>
> *Why* is it different on Solaris?
Fine question. I don’t know. Theo or anyone else using Solaris: Why would we want the timeout to kevent() to be 30ms instead of 10ms as we do for Linux? Can / should we change it to 10ms across the board?
— Leif
Re: [2/4] git commit: TS-1365 Update documentation
Posted by Igor Galić <i....@brainsware.org>.
> > + ``epoll_wait()``. The default value is ``10`` on all platforms except
> > + Solaris, where it is ``30``.
>
> *Why* is it different on Solaris?
165f3686 ->
a5345da8 -> https://svn.apache.org/viewvc?view=revision&revision=r915922
is that supposed to not have any merge tracking?
--
Igor Galić
Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 8716 7A9F 989B ABD5 100F 4008 F266 55D6 2998 1641
Re: [2/4] git commit: TS-1365 Update documentation
Posted by Igor Galić <i....@brainsware.org>.
----- Original Message -----
> TS-1365 Update documentation
This should've been in the same commit as the adding of the feature.
> Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
> Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/a74ef5a0
> Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/a74ef5a0
> Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/a74ef5a0
>
> Branch: refs/heads/master
> Commit: a74ef5a049347a864a0597364d3575ec297eeeb5
> Parents: eccb33c
> Author: Leif Hedstrom <zw...@apache.org>
> Authored: Thu Jan 2 15:18:52 2014 -0700
> Committer: Leif Hedstrom <zw...@apache.org>
> Committed: Thu Jan 2 15:30:53 2014 -0700
>
> ----------------------------------------------------------------------
> .../configuration/records.config.en.rst | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a74ef5a0/doc/reference/configuration/records.config.en.rst
> ----------------------------------------------------------------------
> diff --git a/doc/reference/configuration/records.config.en.rst
> b/doc/reference/configuration/records.config.en.rst
> index c92f351..08aaf1a 100644
> --- a/doc/reference/configuration/records.config.en.rst
> +++ b/doc/reference/configuration/records.config.en.rst
> @@ -2225,6 +2225,26 @@ Sockets
>
> Same as the command line option ``--accept_mss`` that sets the MSS for
> all incoming requests.
>
> +.. ts:cv:: CONFIG proxy.config.net.poll_timeout INT 0
> +
> + Same as the command line option ``--poll_timeout``, or ``-t``, which
> + specifies the timeout used for the polling mechanism used. This timeout
> is
> + always in milliseconds (ms). On Linux, this is the timeout to
> + ``epoll_wait()``. The default value is ``10`` on all platforms except
> + Solaris, where it is ``30``.
*Why* is it different on Solaris?
> + Changing this configuration can reduce CPU usage on an idle system, since
> + periodic tasks gets processed at these intervals. On busy servers, this
> + overhead is diminished, since polled events triggers more
> + frequently. However, increasing the setting can also introduce additional
> + latency for certain operations, and timed events. It's recommended not to
> + touch this setting unless your CPU usage is unacceptable at idle
> + workload. Some alternatives to this could be::
> +
> + Reduce the number of worker threads (net-threads)
> + Reduce the number of disk (AIO) threads
> +
We should link here to the appropriate settings that would require tuning,
or to the (still rather poor) performance tuning document.
> +
> Undocumented
> ============
>
>
>
--
Igor Galić
Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 8716 7A9F 989B ABD5 100F 4008 F266 55D6 2998 1641
[2/4] git commit: TS-1365 Update documentation
Posted by zw...@apache.org.
TS-1365 Update documentation
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/a74ef5a0
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/a74ef5a0
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/a74ef5a0
Branch: refs/heads/master
Commit: a74ef5a049347a864a0597364d3575ec297eeeb5
Parents: eccb33c
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu Jan 2 15:18:52 2014 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Jan 2 15:30:53 2014 -0700
----------------------------------------------------------------------
.../configuration/records.config.en.rst | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a74ef5a0/doc/reference/configuration/records.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/records.config.en.rst b/doc/reference/configuration/records.config.en.rst
index c92f351..08aaf1a 100644
--- a/doc/reference/configuration/records.config.en.rst
+++ b/doc/reference/configuration/records.config.en.rst
@@ -2225,6 +2225,26 @@ Sockets
Same as the command line option ``--accept_mss`` that sets the MSS for all incoming requests.
+.. ts:cv:: CONFIG proxy.config.net.poll_timeout INT 0
+
+ Same as the command line option ``--poll_timeout``, or ``-t``, which
+ specifies the timeout used for the polling mechanism used. This timeout is
+ always in milliseconds (ms). On Linux, this is the timeout to
+ ``epoll_wait()``. The default value is ``10`` on all platforms except
+ Solaris, where it is ``30``.
+
+ Changing this configuration can reduce CPU usage on an idle system, since
+ periodic tasks gets processed at these intervals. On busy servers, this
+ overhead is diminished, since polled events triggers more
+ frequently. However, increasing the setting can also introduce additional
+ latency for certain operations, and timed events. It's recommended not to
+ touch this setting unless your CPU usage is unacceptable at idle
+ workload. Some alternatives to this could be::
+
+ Reduce the number of worker threads (net-threads)
+ Reduce the number of disk (AIO) threads
+
+
Undocumented
============
[3/4] git commit: TS-1365 Make the -t option work as intended.
Posted by zw...@apache.org.
TS-1365 Make the -t option work as intended.
This also adds a new configuration option, proxy.config.net.poll_timeout.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/eccb33cc
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/eccb33cc
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/eccb33cc
Branch: refs/heads/master
Commit: eccb33cc01b109c55d8e21ae10d7366e4044993f
Parents: 52c2da6
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Dec 31 13:38:56 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Thu Jan 2 15:30:53 2014 -0700
----------------------------------------------------------------------
iocore/aio/AIO.cc | 5 ++---
iocore/eventsystem/I_SocketManager.h | 3 ++-
iocore/net/I_Net.h | 8 --------
iocore/net/Net.cc | 2 +-
mgmt/RecordsConfig.cc | 8 ++++++++
proxy/Main.cc | 16 +++++++++++++++-
6 files changed, 28 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/eccb33cc/iocore/aio/AIO.cc
----------------------------------------------------------------------
diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc
index 2e3e91f..ac8ea0f 100644
--- a/iocore/aio/AIO.cc
+++ b/iocore/aio/AIO.cc
@@ -538,9 +538,8 @@ aio_thread_main(void *arg)
op->thread->schedule_imm_signal(op);
ink_mutex_acquire(&my_aio_req->aio_mutex);
} while (1);
- timespec ten_msec_timespec = ink_based_hrtime_to_timespec(ink_get_hrtime() + HRTIME_MSECONDS(10));
- ink_cond_timedwait(&my_aio_req->aio_cond, &my_aio_req->aio_mutex,
- &ten_msec_timespec);
+ timespec timedwait_msec = ink_based_hrtime_to_timespec(ink_get_hrtime() + HRTIME_MSECONDS(net_config_poll_timeout));
+ ink_cond_timedwait(&my_aio_req->aio_cond, &my_aio_req->aio_mutex, &timedwait_msec);
}
return 0;
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/eccb33cc/iocore/eventsystem/I_SocketManager.h
----------------------------------------------------------------------
diff --git a/iocore/eventsystem/I_SocketManager.h b/iocore/eventsystem/I_SocketManager.h
index 57802f4..d294a5c 100644
--- a/iocore/eventsystem/I_SocketManager.h
+++ b/iocore/eventsystem/I_SocketManager.h
@@ -40,6 +40,7 @@
#define DEFAULT_OPEN_MODE 0644
class Thread;
+extern int net_config_poll_timeout;
#define SOCKET int
@@ -85,7 +86,7 @@ struct SocketManager
int epoll_create(int size);
int epoll_close(int eps);
int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
- int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout);
+ int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout = net_config_poll_timeout);
#endif
#if TS_USE_KQUEUE
int kqueue();
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/eccb33cc/iocore/net/I_Net.h
----------------------------------------------------------------------
diff --git a/iocore/net/I_Net.h b/iocore/net/I_Net.h
index d6464e5..78f3d62 100644
--- a/iocore/net/I_Net.h
+++ b/iocore/net/I_Net.h
@@ -62,14 +62,6 @@
static int const NO_FD = -1;
-static unsigned int const DEFAULT_POLL_TIMEOUT =
-#if defined(solaris)
- 30 /* mseconds */
-#else
- 10 /* mseconds */
-#endif
- ;
-
extern int net_config_poll_timeout;
#define NET_EVENT_OPEN (NET_EVENT_EVENTS_START)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/eccb33cc/iocore/net/Net.cc
----------------------------------------------------------------------
diff --git a/iocore/net/Net.cc b/iocore/net/Net.cc
index 2ae2c99..485aef1 100644
--- a/iocore/net/Net.cc
+++ b/iocore/net/Net.cc
@@ -32,7 +32,7 @@
#include "P_Net.h"
RecRawStatBlock *net_rsb = NULL;
-int net_config_poll_timeout = DEFAULT_POLL_TIMEOUT;
+int net_config_poll_timeout = -1; // This will get set via either command line or records.config.
static inline void
configure_net(void)
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/eccb33cc/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 134e029..72a905f 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -796,6 +796,14 @@ RecordElement RecordsConfig[] = {
,
{RECT_CONFIG, "proxy.config.net.sock_mss_in", RECD_INT, "0", RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
,
+ {RECT_CONFIG, "proxy.config.net.poll_timeout", RECD_INT,
+#if defined(solaris)
+ "30",
+#else
+ "10",
+#endif
+ RECU_NULL, RR_NULL, RECC_NULL, NULL, RECA_NULL}
+ ,
//##############################################################################
//#
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/eccb33cc/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 114ade8..1947621 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -153,6 +153,7 @@ HttpBodyFactory *body_factory = NULL;
static int accept_mss = 0;
static int cmd_line_dprintf_level = 0; // default debug output level from ink_dprintf function
+static int poll_timeout = -1; // No value set.
// 1: delay listen, wait for cache.
// 0: Do not delay, start listen ASAP.
@@ -213,7 +214,7 @@ static const ArgumentDescription argument_descriptions[] = {
#endif
{"accept_mss", ' ', "MSS for client connections", "I", &accept_mss, NULL, NULL},
- {"poll_timeout", 't', "poll timeout in milliseconds", "I", &net_config_poll_timeout, NULL, NULL},
+ {"poll_timeout", 't', "poll timeout in milliseconds", "I", &poll_timeout, NULL, NULL},
{"help", 'h', "HELP!", NULL, NULL, NULL, usage},
};
@@ -1451,6 +1452,19 @@ main(int /* argc ATS_UNUSED */, char **argv)
size_t stacksize;
REC_ReadConfigInteger(stacksize, "proxy.config.thread.default.stacksize");
+ // This has some special semantics, in that providing this configuration on
+ // command line has higher priority than what is set in records.config.
+ if (-1 != poll_timeout) {
+ net_config_poll_timeout = poll_timeout;
+ } else {
+ REC_ReadConfigInteger(net_config_poll_timeout, "proxy.config.net.poll_timeout");
+ }
+
+ // This shouldn't happen, but lets make sure we run somewhat reasonable.
+ if (net_config_poll_timeout < 0) {
+ net_config_poll_timeout = 30; // This is the solaris default value.
+ }
+
ink_event_system_init(makeModuleVersion(1, 0, PRIVATE_MODULE_HEADER));
ink_net_init(makeModuleVersion(1, 0, PRIVATE_MODULE_HEADER));
ink_aio_init(makeModuleVersion(1, 0, PRIVATE_MODULE_HEADER));