You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "frostnotfall (via GitHub)" <gi...@apache.org> on 2023/04/12 03:08:28 UTC

[GitHub] [trafficserver] frostnotfall opened a new issue, #9602: Is there a more accurate way to represent cache HIT when using the slice plugin?

frostnotfall opened a new issue, #9602:
URL: https://github.com/apache/trafficserver/issues/9602

   ATS version: 9.1.4
   
   I use header ["cache-status"] to indicate cache hit or miss. it works fine when slice was not used.
   But when using the slice plugin, if the client request is not the FIRST slice, the response header ["cache-status"] always hits even if the cache does not hit.
   
   For example:
   slice zise: 2MB
   request url : http://localhost/xxxxxx.mp4 Range:bytes=2097152-4194303
   
   Delete:
   ![image2023-4-11_16-12-35](https://user-images.githubusercontent.com/38377709/231333775-3e96dc24-17b9-416b-aefe-862c6633f6e1.png)
   
   Then request again:
   <img width="1390" alt="image2023-4-11_16-57-18" src="https://user-images.githubusercontent.com/38377709/231337056-c7d3c1ab-2a7f-4656-a73b-6cc1e62f6f9d.png">
   
   The access.log:
   ![image2023-4-11_16-56-47](https://user-images.githubusercontent.com/38377709/231334815-4c92dbcc-98ef-4234-a505-1f095aeddd7f.png)
   ![image2023-4-11_16-57-3](https://user-images.githubusercontent.com/38377709/231334852-c36a3c61-0a30-473a-8921-973f9f072537.png)
   
   Does the response header always follow the first slice?
   
   How can I get a more accurate cache-status?
   
   Here is my configure:
   remap.config
   ```
   map http://127.0.0.1/ http://x.x.x.x/ \
       @plugin=slice.so  @pparam=--blockbytes=2m @pparam=--remap-host=loopback
   
   map http://loopback/ http://x.x.x.x/ \
       @plugin=cachekey.so @pparam=--include-headers=Range @pparam=--remove-prefix=true @pparam=--remove-all-params=true \
       @plugin=cache_range_requests.so @pparam=--no-modify-cachekey @pparam=--consider-ims \
       @plugin=/xxx/libexec/trafficserver/tslua.so @pparam=/xxx/etc/trafficserver/cache.lua
   ```
   lua script:
   ```lua
   function cache_lookup()
       local cache_status = ts.http.get_cache_lookup_status()
       ts.debug(cache_status)
       ts.ctx['cstatus'] = cache_status
   end
   
   function cache_status_to_string(status)
       if status == TS_LUA_CACHE_LOOKUP_MISS then
          return "MISS"
       end
   
       if status == TS_LUA_CACHE_LOOKUP_HIT_FRESH then
          return "HIT"
       end
   
       if status == TS_LUA_CACHE_LOOKUP_HIT_STALE then
          return "MISS"
       end
   
       if status == TS_LUA_CACHE_LOOKUP_SKIPPED then
          return "PASS"
       end
   
       return "bug"
   end
   
   function gen_x_cache_int()
       local cache_status = cache_status_to_string(ts.ctx['cstatus'])
       ts.client_response.header['cache-status'] = cache_status
   end
   
   function do_remap()
       ts.hook(TS_LUA_HOOK_CACHE_LOOKUP_COMPLETE, cache_lookup)
       ts.hook(TS_LUA_HOOK_SEND_RESPONSE_HDR, gen_x_cache_int)
       return 0
   end
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] traeak closed issue #9602: Is there a more accurate way to represent cache HIT when using the slice plugin?

Posted by "traeak (via GitHub)" <gi...@apache.org>.
traeak closed issue #9602: Is there a more accurate way to represent cache HIT when using the slice plugin?
URL: https://github.com/apache/trafficserver/issues/9602


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] traeak commented on issue #9602: Is there a more accurate way to represent cache HIT when using the slice plugin?

Posted by "traeak (via GitHub)" <gi...@apache.org>.
traeak commented on issue #9602:
URL: https://github.com/apache/trafficserver/issues/9602#issuecomment-1521698289

   You have to use the cache_range_requests.so plugin with the slice plugin to get proper behavior.  The slice plugin itself has no interaction with the caching layer, it delegates it through to the cache_range_requests plugin.  So you would put the CRR  plugin in the loopback rule and then use loopback rule's status to check the cached items.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] bryancall commented on issue #9602: Is there a more accurate way to represent cache HIT when using the slice plugin?

Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall commented on issue #9602:
URL: https://github.com/apache/trafficserver/issues/9602#issuecomment-1520917936

   @traeak Can you please reply to this question?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org