Tunning HAProxy performance by use multiple processors and config caching for frontend

I/Config multithreading by use multiple processor for frontend:

#Define cpu-map in global:

global

      nbproc 4  #generate 4 process when haproxy started

      cpu-map 1 0

      cpu-map 2 1

      cpu-map 3 2

      cpu-map 4 3

frontend web_in

      bind-process 1 2 3 4

II/Use small cache for user’s file access:

1/Define acl for using/store file to cache named image by URL:

frontend web_in

      http-request set-var(txn.path) path

      acl is_image if path -i -m sub images   # Define acl name is_image by URL

      http-request cache-use image if is_image  #Using cache store named image 

      http-request cache-store image if is_image  #Store files request to cache store named image

2/Define cache store for frontend using/storing:

cache image

       max-age  210 # in seconds

      total-max-size   3   # allow cache total maximum 3MB for a same host and same URI request

global

     tune.bufsize ‭32768‬ # not store file to cache store if larger than 32KB

BÌNH LUẬN

Vui lòng nhập bình luận của bạn
Vui lòng nhập tên của bạn ở đây