Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Lightsquid Hit Percentage

    Scheduled Pinned Locked Moved 2.3-RC Snapshot Feedback and Issues - ARCHIVED
    14 Posts 3 Posters 3.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      maverick_slo
      last edited by

      I think I found why HIT is always 0.00%

      /usr/local/www/lightsquid/lightparser.pl
      LINE 205

      if ($Ltype =~ m/HIT/) {
      	  $CacheHIT+=$Lsize;
      	} else {
      	  $CacheMISS+=$Lsize;
      	}
      

      HIT and also TCP_REFRESH_UNMODIFIED/200 should count as served from cache right?

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        That is not pfSense package code, it's lightsquid code. Not our circus, not our monkeys.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • M
          maverick_slo
          last edited by

          Thank you.

          But not to start whole new thread for that, can you please show me how to add my string to the line in question?

          if ($Ltype =~ m/HIT/) {
            $CacheHIT+=$Lsize;
          } else {
            $CacheMISS+=$Lsize;
          }

          Thanks a bunch!

          1 Reply Last reply Reply Quote 0
          • M
            maverick_slo
            last edited by

            And I already started new thread - I deleted it.
            Post:

            Hi all!

            I`ve installed lightsquid on 2.3 (thanks Jimp!) and encountered some issues with interpretation of what is hit and what is not.

            In lightparser.pl there is condition:

            if ($Ltype =~ m/HIT/) {
                 $CacheHIT+=$Lsize;
               } else {
                 $CacheMISS+=$Lsize;
               }
            

            It is wrong in my opinion as it should also take in account TCP_REFRESH_UNMODIFIED.

            So how to modify this condition to reflect correct status?

            As I can see it, lightsquid project is dead, maybe we could alter the package code to reflect this change?

            Thanks!

            1 Reply Last reply Reply Quote 0
            • M
              maverick_slo
              last edited by

              I did it like this:

              
              if ($Ltype =~ m/HIT/) {
              	  $CacheHIT+=$Lsize;
              	} 
                  if ($Ltype =~ m/UNMODIFIED/) {
              	  $CacheHIT+=$Lsize;
              	} 
              else {
              	  $CacheMISS+=$Lsize;
              	}
              

              I`m not a coder :)

              1 Reply Last reply Reply Quote 0
              • rbgargaR
                rbgarga Developer Netgate Administrator
                last edited by

                @maverick_slo:

                I did it like this:

                
                if ($Ltype =~ m/HIT/) {
                	  $CacheHIT+=$Lsize;
                	} 
                    if ($Ltype =~ m/UNMODIFIED/) {
                	  $CacheHIT+=$Lsize;
                	} 
                else {
                	  $CacheMISS+=$Lsize;
                	}
                

                I`m not a coder :)

                Try this:

                
                if ($Ltype =~ m/(HIT|UNMODIFIED)/) {
                	$CacheHIT+=$Lsize;
                } else {
                	$CacheMISS+=$Lsize;
                }
                
                

                Renato Botelho

                1 Reply Last reply Reply Quote 0
                • M
                  maverick_slo
                  last edited by

                  Thanks Renatho!

                  It does the trick :)

                  Could we implement this in package if it is correct?

                  According to: http://wiki.squid-cache.org/SquidFaq/SquidLogs?action=fullsearch&context=180&value=TCP_REFRESH_UNMODIFIED&titlesearch=Titles#Squid_result_codes
                  and: http://squid-web-proxy-cache.1019090.n4.nabble.com/A-lot-of-TCP-REFRESH-UNMODIFIED-after-upgrading-squid-td4660249.html

                  TCP_REFRESH_UNMODIFIED is actually a HIT based on the origin server(or a
                  parent proxy).
                  if you have lots of TCP_REFRESH_UNMODIFIED in your log file you can tell
                  your clients (in a case of only one proxy between the client and the
                  site) that they get it from cache while making sure it's the file they
                  should get and also the server knows that yet another client gets a good
                  and valid reply.

                  So REFRESH UNMODIFIED is actually a HIT and a lot more of REFRESH UNMODIFIED appeared in Squid 3.X.

                  1 Reply Last reply Reply Quote 0
                  • jimpJ
                    jimp Rebel Alliance Developer Netgate
                    last edited by

                    No, it's in lightsquid's code, not ours. You'd have to submit that to the lightsquid project (assuming it hasn't been abandoned)

                    Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                    Need help fast? Netgate Global Support!

                    Do not Chat/PM for help!

                    1 Reply Last reply Reply Quote 0
                    • M
                      maverick_slo
                      last edited by

                      All I can see are dates 2010 and lower.
                      So I guess this won't be possible?

                      1 Reply Last reply Reply Quote 0
                      • rbgargaR
                        rbgarga Developer Netgate Administrator
                        last edited by

                        @maverick_slo:

                        All I can see are dates 2010 and lower.
                        So I guess this won't be possible?

                        I've added the fix into FreeBSD's ports tree - https://svnweb.freebsd.org/ports?view=revision&revision=409887

                        It'll be imported to pfSense ports tree soon

                        Renato Botelho

                        1 Reply Last reply Reply Quote 0
                        • M
                          maverick_slo
                          last edited by

                          Thanks!

                          I can only say that I will stick with pfsense `till the end :)

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.