HAProxy cpu-map not compiled in?

  • Was trying to configure the cpu-map options but when I Apply the changes it complains about not being compiled in

    [ALERT] 258/212829 (97293) : parsing [/var/etc/haproxy_test/haproxy.cfg:11] : 'cpu-map' is not enabled, please check build options for USE_CPU_AFFINITY.

    Anyway to use this option in 2.2.4 with haproxy 1_5 0.30?


  • Hi dsefcik,

    There is (currently) no way to use this option on FreeBSD with current haproxy implementation..

    The required/used function "sched_setaffinity" does not exist in FreeBSD. However i did see that a different function could be used. In FreeBSD the function is called "cpuset_setaffinity" and has some slightly different parameters.. The important once's match though so should be possible to implement both for Linux and FreeBSD besides each other..

    Ill try and submit a patch to haproxy, so that maybe next 1.6-dev release it can be included & compiled in.

    Any other options you found 'missing' that could be useful ?


  • Thanks PIBa….I cannot think of anything else...I was just looking at how to utilize all of the cpu's I have and wanted try that option to give each front end it's own cpu.

    BTW, not sure if I posted in the correct topic area, please advise if I should post elsewhere for haproxy.

  • Probably someone will come along to move the question to the child-board: Packages \ Cache/Proxy https://forum.pfsense.org/index.php?board=60.0 which is where most haproxy questions are. For myself it doesn't matter much, i always search the whole forum for topics that mention the word haproxy..

    But please don't double post it there now, that is worse imho that using the wrong area.

  • Ok patch has been send & merged. Now we will just need to wait for 1.6-dev6 to be released. That might take a month or two.. After that we can get it compiled with that build option for pfSense.

  • Thanks, will look forward to trying it out..

  • @PiBa:

    Any other options you found 'missing' that could be useful ?


    Many of the Balance Algorithms seem to be missing http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#4.2-balance

  • I was referring more to 'compile options' that are useful/wanted but currently not in the compiled into the binary package.

    But indeed some more balance options could probably be added besides the 4 i currently show. Though those should all already be available in the actual haproxy binary. So for the 'more advanced' settings it could be possible to add them in the advanced free text field. It is not my intention to make every option that haproxy has available through the WebGUI, but am open to suggestions. Ill try and see if i can easily add a few more of those balance options to the gui do you have a particular one you would 'need' ?

  • I thought about using the advanced options but was not sure how that would "replace" a gui option already defined, I am happy to try if that would actually work. Specifically was interested in trying the URI option since I use it in front of squid proxies. Thanks for listening… :)


    uri       This algorithm hashes either the left part of the URI (before
                  the question mark) or the whole URI (if the "whole" parameter
                  is present) and divides the hash value by the total weight of
                  the running servers. The result designates which server will
                  receive the request. This ensures that the same URI will
                  always be directed to the same server as long as no server
                  goes up or down. This is used with proxy caches and
                  anti-virus proxies in order to maximize the cache hit rate.

                  Note that this algorithm may only be used in an HTTP backend.
                  This algorithm is static by default, which means that
                  changing a server's weight on the fly will have no effect,
                  but this can be changed using "hash-type".

    This algorithm supports two optional parameters "len" and
                  "depth", both followed by a positive integer number. These
                  options may be helpful when it is needed to balance servers
                  based on the beginning of the URI only. The "len" parameter
                  indicates that the algorithm should only consider that many
                  characters at the beginning of the URI to compute the hash.
                  Note that having "len" set to 1 rarely makes sense since most
                  URIs start with a leading "/".

    The "depth" parameter indicates the maximum directory depth
                  to be used to compute the hash. One level is counted for each
                  slash in the request. If both parameters are specified, the
                  evaluation stops when either is reached.

  • Using the current gui the trick i suppose is to not select any of the 4 balancing options when creation the backend, once one is selected its not possible to deselect all those radio-buttons.. Ill see if can add that balance uri into the webgui itself.

  • @PiBa:

    Using the current gui the trick i suppose is to not select any of the 4 balancing options when creation the backend, once one is selected its not possible to deselect all those radio-buttons.. Ill see if can add that balance uri into the webgui itself.

    Great, thank you for your efforts!

  • Checkout the new haproxy-devel package if you have some time, its now based on 1.6.2 and has cpu-map feature compiled in.
    p.s. make a config backup before upgrading, as a few config changes are automatically made.. In case you need to revert..

    If you have any questions/problems/requests regarding haproxy let me know.

  • I finally have 1.5 running well in our environment but will try to test out 1.6 soon, thanks for your efforts.

    BTW, is there an easy way to backup the existing config to revert back if there are problems? TIA

  • Currently no easy way.. Best is probably to create a backup of the whole pfSense configuration from diagnostics\backup-restore to start with.

    Before reverting to a old config uninstall the haproxy-devel package so the new binaries are also uninstalled..

    Then if you upgrade the package, and dont make much changes. You should be able to revert to a previous config from before upgrading under diagnostics\backup-restore\history.  But that is only possible 30 changes back depending on how much you change after upgrading that might not be enough..

    Otherwise if you do make other changes in firewall-rules or other things, and you want to keep those you might want to take another backup and manually 'merge' the old <haproxy>part into the new backup file, and restore that.. p.s. Restoring a full config will reboot pfSense..(a full restore will also re-install all packages automatically iirc..)

    After a config is restored make sure to re-install the 1_5 package to get the 1.5 binaries installed again.

    Other option is to just re-install the 1_5 package with the upgraded config, it will mostly still work though backend selections acl-names need to be checked.. And when upgrading again in the future it probably wont upgrade as nicely as it would on a first time.. (it automatically changes combined acl's names and creates matching use_backend actions..)

    Now i just hope you will find 1.6 working fine :) , and there wont be any need to go back.</haproxy>

Log in to reply