Question about threads

Michael S. Fischer michael at dynamine.net
Tue Jun 17 22:17:52 CEST 2008


Raising the number of threads will not significantly improve Varnish
concurrency in most cases.  I did a test a few months ago using 4 CPUs on
RHEL 4.6 with very high request concurrency and a very low
request-per-connection ratio (i.e., 1:1, no keepalives) and found that the
magic number is about 16 threads/CPU.  You should raise overflow_max to a
very high value (10000% worked just fine for us).

Under optimal operating conditions you should not see the "threads not
created" value increasing like this.

Best regards,

--Michael

On Tue, Jun 17, 2008 at 3:37 AM, <duja at torlen.net> wrote:

> I recently made a loadtest against through varnish.
>
> First I received a very high response time and found out that varnish was
> maxing the maximum nr of threads.
>
> I updated thread_min = 5 and thread_max = 300 and recevied much better
> resp. times.
>
> Then I increased the nr of concurrent users and made another loadtest. The
> strange thing here was that I received high resp. times but the threads
> stopped at 238.
>
> The "N worker threads not created" increased rapidly.
>
> I increased the threads again and changed listen_depth to 2048.
>
> Here is all the numbers:
>         238         0.00         0.22 N worker threads created
>        1318         4.98         1.21 N worker threads not created
>
>    0 Debug        - "Create worker thread failed 12 Cannot allocate memory"
>    0 Debug        - "Create worker thread failed 12 Cannot allocate memory"
>    0 Debug        - "Create worker thread failed 12 Cannot allocate memory"
>    0 Debug        - "Create worker thread failed 12 Cannot allocate memory"
>    0 Debug        - "Create worker thread failed 12 Cannot allocate memory"
>    0 Debug        - "Create worker thread failed 12 Cannot allocate memory"
>    0 Debug        - "Create worker thread failed 12 Cannot allocate memory"
>    0 Debug        - "Create worker thread failed 12 Cannot allocate memory"
>
> default_ttl                120 [seconds]
> thread_pools               2 [pools] <<<<
> thread_pool_max            400 [threads] <<<<
> thread_pool_min            10 [threads] <<<<
> thread_pool_timeout        120 [seconds]
> thread_pool_purge_delay    1000 [milliseconds]
> thread_pool_add_threshold  2 [requests]
> thread_pool_add_delay      10 [milliseconds]
> thread_pool_fail_delay     200 [milliseconds]
> overflow_max               100 [%]
> rush_exponent              3 [requests per request]
> sess_workspace             8192 [bytes]
> obj_workspace              8192 [bytes]
> sess_timeout               5 [seconds]
> pipe_timeout               60 [seconds]
> send_timeout               600 [seconds]
> auto_restart               on [bool]
> fetch_chunksize            128 [kilobytes]
> vcl_trace                  off [bool]
> listen_address             0.0.0.0:80
> listen_depth               2048 [connections] <<<<
> srcaddr_hash               1049 [buckets]
> srcaddr_ttl                30 [seconds]
> backend_http11             off [bool]
> client_http11              off [bool]
> cli_timeout                5 [seconds]
> ping_interval              3 [seconds]
> lru_interval               2 [seconds]
> cc_command                 exec cc -fpic -shared -Wl,-x -o %o %s
> max_restarts               4 [restarts]
> max_esi_includes           5 [restarts]
> cache_vbe_conns            off [bool]
> connect_timeout            400 [ms]
> cli_buffer                 8192 [bytes]
> diag_bitmap                0x0 [bitmap]
>
> Why do I get "Create worker thread failed 12 Cannot allocate memory" when I
> had 1900MB free RAM and 65GB free Disk on the server? Any ideas?
>
> If "N worker threads not created" is increasing, is that a bad sign?
>
> Thanks
> Duja
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at projects.linpro.no
> http://projects.linpro.no/mailman/listinfo/varnish-misc
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20080617/1e8e96c5/attachment-0001.html>


More information about the varnish-misc mailing list