varnish + gatling http first read error: EOF

2016-09-21 Thread Tobias Honacker
Hi all,

we are facing some issues trying to stresstest our oAuth App using Varnish
4.0.3 and Gatling

Infra:

LB -> Apache (SSL Offloading) + Varnish -> Appserver (Apache + Tomcat)

Varnishlog:
http://pastebin.com/tCWgi01H

VCL:
http://pastebin.com/cEdzAwxs

tcpdump on our app server with 1 req/s (varnishlog 200):
http://pastebin.com/XFVsANiN

tcpdump on our app server with >= 2 req/s (varnishlog 503er):
http://pastebin.com/f2EKADpx

If varnish throws HTTP 503 the connection: close header is missing

Running tests using pipe works fine, because pipe sets connection: close
Running tests without varnish works fine, too.

The Apaches using KeepAlive:

KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 10


Any suggestions?

Thanks in advance and best regards
Tobias
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Re: Asking for backend set in VCL 4

2016-04-26 Thread Tobias Honacker
Hi,

what about this code

sub vcl_recv {
  set req.backend_hint = foo;
  set req.http.CurrentBackend = foo;

  if ( some condition ) {
   set req.backend_hint = bar;
   set req.http.CurrentBackend = bar;
  }

  if ( req.http.CurrentBackend ~ "foo" ) {
   /* do sth nasty */
  }
}


Viele Grüße / Regards
Tobias

2016-04-26 14:26 GMT+02:00 Andreas Haase - evolver group <
andreas.ha...@evolver.de>:

> Hello,
>
> we are just migrating one varnish from 3.x to 4.0.2 (contained in Debian
> Jessie). Our old vcl contains the following structure:
>
> [...]
>
> sub vcl_recv {
>set req.backend = foo;
>
>if (some condition) {
>set req.backend = bar;
>}
>
>[...]
>
>if ( req.backend = foo ) {
>/* do something nasty */
>}
>
>[...]
> }
>
> Now, in VCL 4 there seems no possibility to ask for the backend actually
> set. Is there any way to use this again, or do we have to use a
> work-around like setting custom http headers and later asking for their
> content?
>
> Thank you in advance for any hint :-)
>
> --
> Regards,
>
> Andreas Haase
>
> Administration und Technik
> evolver services GmbH
>
> Fon:+49 / (0)3 71 / 4 00 03 727
> Fax:+49 / (0)3 71 / 4 00 03 79
>
> E-Mail  andreas.ha...@evolver.de
> Web http://www.evolver.de
> Facebookhttp://www.facebook.de/evolvergroup
>
>
> Sitz der Gesellschaft:  Chemnitz
> Handelsregister:Amtsgericht Chemnitz, HRB 22649
> Geschäftsführer:Torsten Gramann und Mathias Möckel
>
> [zu unserer Webseite]
> Unsere Top-Produkte:
> - Stellenportal
> - Immobilienportal
> - evolverOAS
> - evolverCAS
> - evolverCMS
>Unsere Top-Dienstleistungen:
> - Administration & IT
> - Service-Center
> - garantierte Ressourcen<
> http://www.evolver.de/dienstleistungen/garantierte_ressourcen/>
> - Manntage-Pakete
> - evolverCLOUD
>SEO-Optimierung inklusive:
> Zur Verbesserung Ihrer Marktchancen mit unseren Produkten investieren wir
> noch mehr in die SEO-Optimierung.
> Terminvereinbarung für Präsentationen und Workshops
> Sie haben die Wahl, wie wir Ihnen unsere Produkte und Dienstleistungen
> vorstellen dürfen.
> Vereinbaren Sie einen Termin: www.evolver.de/termin<
> http://www.evolver.de/termin>.
>
>
> ___
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Re: Varnish install on aws

2016-02-15 Thread Tobias Honacker
FYI: Your backend listen on Port 8080, so you should define this in your
varnish config (.vcl) in /etc/varnish


   1. backend default {
   2.   .host = "127.0.0.1";
   3.   .port = "8080";
   4. }


Varnish Port 80 -> open port 80 on your firewall (Security Group AWS)
Backend Port 8080 -> no need to open port 8080 on your firewall (Security
Group AWS)

So your /etc/sysconfig/varnish might look like:

DAEMON_OPTS="-a :80 \
 -f /etc/varnish/default.vcl \
  T localhost:6082 \
 -S /etc/varnish/secret \
 -u varnish -g varnish \
 -s file,/var/lib/varnish/varnish_storage.bin,1G"

hint: with defining the backend in your config you do not need to specify
this in your daemon_opts.

If you type /etc/init.d/varnish restart and you get Stopping Varnish Cache:
 [FAILED] this might be because your varnish daemon is not alive and cant
be stopped :)

You should also read http://book.varnish-software.com/4.0/


2016-02-15 11:05 GMT+01:00 Mike Jones <michaeljones...@gmail.com>:

> The output of ‘bash -x /etc/init.d/varnish start’ is
> http://pastebin.com/YiqFDgYJ
>
> vcl config from '/etc/varnish/default.vcl' is http://pastebin.com/wEideMfC
>
> Output of 'netstat -tulpn and iptables -vnL' is
> http://pastebin.com/n5TYJVH5
>
> Thanks
>
> On Sat, Feb 13, 2016 at 7:33 PM, Tobias Honacker <
> t.honac...@googlemail.com> wrote:
>
>> Hi,
>>
>> please send the vcl config and the output of netstat -tulpn and iptables
>> -vnL
>>
>>
>> greetings
>>
>> 2016-02-13 17:56 GMT+01:00 Mike Jones <michaeljones...@gmail.com>:
>>
>>> I have a 'WordPress basic single instance' from
>>> http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/sample-templates-applications-us-west-1.html
>>>
>>> and my varnish file, located in /etc/sysconfig/varnish, looks like
>>>
>>> http://pastebin.com/hZNr6Apc
>>>
>>> While my httpd conf file, /etc/httpd/conf/httpd.conf, looks like
>>>
>>> http://pastebin.com/xeZs8KQq
>>>
>>> Running varnishstat looks like it's running but when visiting the
>>> webserver through the browser the page fails to load.
>>>
>>> On Sat, Feb 13, 2016 at 4:15 PM, Brad Tarver <i...@pobox.com> wrote:
>>>
>>>> 6082 is the admin port
>>>>
>>>> This is my config on ubuntu: http://pastebin.com/E3tQ1eC1
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Brad Tarver
>>>>
>>>>
>>>> Mike Jones wrote:
>>>>
>>>> Yes, I was talking about the security group, I did open that but it
>>>> didn't make any difference.
>>>>
>>>> With the settings previously mentioned I tried running curl on port 80
>>>> on I get
>>>>
>>>> curl: (7) Failed to connect to localhost port 80: Connection refused.
>>>>
>>>> On port 8080 I get the default apache page, but adding a directory
>>>> after the port 'curl 127.0.0.1:8080/wordpress' I get an error saying
>>>> the page has moved.
>>>>
>>>> On port 6082 I get 'Authentication required'
>>>>
>>>>
>>>> On Sat, Feb 13, 2016 at 1:41 PM, Lee Trout <l...@leetrout.com> wrote:
>>>>
>>>>> > Do I need to open port 8080 too?
>>>>>
>>>>> Open it where? In a security group? You should make sure you have port
>>>>> 80 open in your security group but that won't affect local host.
>>>>>
>>>>> You should try curling against the interfaces on the box from the box
>>>>> itself and make sure it's actually sending info back locally. With your
>>>>> config  I believe you should be able to curl local host on port 80 as well
>>>>> since you only specified a listening port.
>>>>>
>>>>> On Saturday, February 13, 2016, Mike Jones <michaeljones...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have a single ec2 instance running and would like to install and
>>>>>> configure Varnish for that aws instance
>>>>>>
>>>>>> I've changed the default settings for varnish - /etc/sysconfig/varnish
>>>>>>
>>>>>> DAEMON_OPTS="-a :80 \
>>>>>>  -T localhost:6082 \
>>>>>>  -b localhost:8080 \
>>>>>&g

Re: Bypass cache when add to cart ?

2015-12-23 Thread Tobias Honacker
Hi Xavier,

maybe this snippet will help you

Cookie: https://github.com/lkarsten/libvmod-cookie
Query String: https://github.com/Dridi/libvmod-querystring

default.vcl:

import cookie;
import querystring;

sub vcl_recv:

if (req.url ~ "^/random/url") {
cookie.parse(req.http.Cookie);
   cookie.filter_except("cookie_woocommerce");
if ((cookie.isset("cookie_woocommerce")) {
  return(pass);
} else {
  return(hash);
}
} // to get the value out of the cookie -> cookie.get("woocommerce") !=
"false"

and something like this

 set req.url = querystring.sort(req.url);
 set req.url = querystring.filter(req.url, "query_string");
 ... do some magic

2015-12-23 21:05 GMT+01:00 Guillaume Quintard <
guilla...@varnish-software.com>:

>
> On Dec 23, 2015 20:51, "Xavier Cardil Coll"  wrote:
> >
> > No one knows then ? Not even a hint or something ?
> >
> > 2015-12-23 13:15 GMT+01:00 Xavier Cardil Coll :
> >>
> >> Also, how to write a function to bypass cache entirely when a user logs
> in ?
> >>
> >> 2015-12-23 12:39 GMT+01:00 Xavier Cardil Coll :
> >>>
> >>> On Nginx cache, you can do this to avoid keep on caching when you add
> something to the cart in Woocommerce :
> >>>
> >>> Skip cache for WooCommerce query string
> >>>
> >>> if ( $arg_add-to-cart != "" ) {
> >>>   set $skip_cache 1;
> >>> }
> >>>
> >>> Skip cache when WooCommerce cart is not empty
> >>>
> >>> if ( $cookie_woocommerce_items_in_cart != "0" ) {
> >>> set $skip_cache 1;
> >>> }
> >>>
> >>> How can you do this in Varnish ? With this config, wich was made
> specifically for Wordpress + Woocommerce, when you add something to cart,
> cache is not disable store wide so you get a mix of cached and non cache
> pages, cart gets emptied : http://pastebin.com/TuYeMtUZ
> >>>
> >>>
> >>> --
> >>>
> >>> ELSITAR
> >>>
> >>>
> >>
> >>
> >>
> >> --
> >>
> >> ELSITAR
> >>
> >>
> >
> >
> >
> > --
> >
> > ELSITAR
> >
> >
> >
> > ___
> > varnish-misc mailing list
> > varnish-misc@varnish-cache.org
> > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
> Chill out, most of the people are in vacation :-)
>
> So, in varnish, by default, if the request contains a cookie, the cache is
> bypassed.
>
> But you can also force a pass, for example if the request contains a
> "foo-bar" header like so :
>
> sub vcl_recv {
>if (req.http.foo-bar) {
>   return (pass);
>}
> }
>
> For your needs, look at the query string and cookie vmods, it will allow
> to really fine-tune your workflow.
>
> And should you need more help, we are here :-)
>
> ___
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Varnish and AWS ELB

2015-09-14 Thread Tobias Honacker
Hi guys,

i currently stuck on the following setup:

Client / Request -> 1x ELB (LBCookieStickinessPolicy) -> 2x Varnish -> 3x
Backend

I need to setup session stickyness otherwise backend sends CSRF-Token is
invalid.
AWS ELB sends cookies like: AWSELB=
E5D3B9C50EAF269F2C074A8A0DA1A422FAB5B73E769AA411DD448..

If i send the first request to my website, ELB created the cookie and sent
the request to varnish1. After reloading the website (second request) ELB
created a new cookie and is balancing to the second varnish.

Does anyone know how to fix this issue?

Thanks and regards
Tobias
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

malloc and caching misses

2015-07-29 Thread Tobias Honacker
Hi guys,

first of all we are using malloc 16G and varnish currently using  25G of
our memory so the vm begin to swap. n_lru_nuked value raise up quickly.


  PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+  COMMAND
65265 nobody20   0 27.3g  25g  81m S 12.3 82.2 463:09.42 varnishd

root  /usr/sbin/varnishd -P /var/run/varnish.pid -a 127.0.0.1:8080 -f
/etc/varnish/default.vcl -T 127.0.0.1:6082 -t 120 -S /etc/varnish/secret -s
malloc,16G
nobody  /usr/sbin/varnishd -P /var/run/varnish.pid -a 127.0.0.1:8080 -f
/etc/varnish/default.vcl -T 127.0.0.1:6082 -t 120 -S /etc/varnish/secret -s
malloc,16G

Further we cache our main site /.
The first varnish proxy logs many cache misses on /, the second varnish
proxy not.
I ran following command to monitor this behavior for ~20 minutes

varnishlog -g request -q RespHeader eq 'X-Cache: MISS' -i ReqUrl |grep
ReqURL | awk '{print $3}'

and the output is that varnish logs 432 cache misses on / using
beresp.ttl = 300s on that site.
Both configs (varnish 1 and varnish 2) are the same using puppet to publish
the configs.


Env:

varnishd (varnish-4.0.2 revision bfe7cd1)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2014 Varnish Software AS

Red Hat Enterprise Linux Server release 6.6 (Santiago)

User - 2 keepalives - 2 varnishes - backend (tomcat)

VCL snippet:

sub vcl_recv:

if( req.url ~ ^/$) {

  return (hash);
}

return (pass);


sub vcl_backend_response:

if ((beresp.status == 200)  (beresp.http.Cache-Control ~ max-age)) {
return (deliver);
  }


Thanks,
Tobias
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Varnish Puppet Module

2014-09-09 Thread Tobias Honacker
Hi guys,

is there any official Puppet Module out there for using Varnish 3 (Varnish
4 support not a must-have)?
We are using Puppet 3 with Hiera. If not has anyone some favourite Puppet
Modules?


Thanks and best regards,
Tobias
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

503 remove backends response

2014-07-21 Thread Tobias Honacker
Hi all,

first some details of my varnish:

varnish-3.0.5-1.el6.x86_64
varnish-libs-3.0.5-1.el6.x86_64


We are trying to remove the response of 503 status the backend delivers to
our varnish.

--snip--

 37 TxHeader b X-Backend-Healthy: yes
   37 TxHeader b X-Varnish: 1092996393
   37 RxProtocol   b HTTP/1.1
   37 RxStatus b 503
   37 RxResponse   b Service Unavailable
   37 RxHeader b Server: cloudflare-nginx
   37 RxHeader b Date: Mon, 21 Jul 2014 14:18:51 GMT
   37 RxHeader b Content-Type: text/html
   37 RxHeader b Transfer-Encoding: chunked
   37 RxHeader b Connection: keep-alive
   37 RxHeader b Set-Cookie: __
   37 RxHeader b Cache-Control: no-cache
   37 RxHeader b CF-Cache-Status: MISS
   37 RxHeader b Vary: Accept-Encoding
   37 RxHeader b CF-RAY:
   37 Fetch_Body   b 3(chunked) cls 0 mklen 1
   37 Length   b 459
   37 BackendReuse b host_1

--snip--

These Backend includes ESI to our site and if the backend (not sick at this
time) throw a 503 to our varnish we see the nginx error message at our page:

Error 503 .. Service Unavailable ...and so on

Now we tried to fix this using in vcl_error these method without success:

if ( (obj.status = 500 || obj.status = 505)  (req.url ~ ^/appserver/)
) {
  set obj.http.Cache-Control = public, max-age=10;
  set obj.status = 200;
  set obj.response = OK;
  return (deliver);
  }

we are aiming to serve a blank 200 status so that the error disappear on
our site where the ESI is included.

how could we fix that issue? is there any way not using synthetic while
serving blank html code? i dont like this workaround.

thanks a lot for any help.

best regards
tobias
___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Varnish - set backend if statuscode is 404

2013-11-27 Thread Tobias Honacker
Hey guys,

i’ve got one problem and don’t know how to solve this problem.
I have to use another backend if the req.url matches AND HTTP Status is 404.

sub vcl_recv {
if (req.url ~ „^/path/to/images) {
 set req.backend = p1_backend;
 set req.http.host = www.mysite.de“;
 }

How to solve the 404 Status?


varnishd -V
varnishd (varnish-3.0.2 revision 55e70a4)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2011 Varnish Software AS


Thanks for any information.


Best regards,
Tobias


___
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc