Yes PF will pre-compile the templates on demand.
Also if you change the content of the template it will get recompiled.

Ignore the original configuration file was missed spelled if you notice it has an underscore.

Since it was never used no never noticed.

The proper path is /usr/local/pf/html/captive-portal/captiveportal.conf (without the underscore)

James Rouzier
[email protected] :: +1.514.755.3630  ::  http://www.inverse.ca
Inverse inc. :: Leaders behind SOGo (http://www.sogo.nu) and PacketFence 
(http://www.packetfence.org)

On 2015-06-18 12:46 PM, Andy A wrote:
Thanks. Will PF automatically pre-compile the cache if I add the following to captiveportal.conf?
<View::HTML>
COMPILE_DIR /usr/local/pf/var/captiveportal/cached_templates
</View::HTML>

I currently have the default configuration for captiveportal.conf

# rename this file to captiveportal.yml and put a ':' after 'name' if
# you want to use YAML like in old versions of Catalyst
name captiveportal
<Hooks>
    <Root>
        <maxRegNodesReached>
            override Status index
        </maxRegNodesReached>
    </Root>
</Hooks>


------------------------------------------------------------------------
Date: Thu, 18 Jun 2015 10:42:28 -0400
From: [email protected]
To: [email protected]
Subject: Re: [PacketFence-users] Caching for Captive Portal

Andy,

There is one more thing you could do is have the template precompiled in a cache

Here is how you can set it up

cat <<EOF > /usr/local/pf/html/captive-portal/captiveportal.conf
name captiveportal

<View::HTML>
COMPILE_DIR /usr/local/pf/var/captiveportal/cached_templates
</View::HTML>
EOF

Then restart the captive portal

/usr/local/pf/bin/pfcmd service httpd.portal restart


James Rouzier
[email protected]  <mailto:[email protected]>  :: +1.514.755.3630  
::http://www.inverse.ca
Inverse inc. :: Leaders behind SOGo (http://www.sogo.nu) and PacketFence 
(http://www.packetfence.org)
On 2015-06-18 9:41 AM, Andy A wrote:

    Okay great. Thanks for the reply.  I have done the following.

    I have changed the following line to track the 'serving' time for
    a page.
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
    \"%{User-Agent}i\" **%T/%D**" combined (added %T/%D)

    For number of processes for httpd:

    With a single device, after the pfdhcplistener is done, for the
    first ever request to the captive portal, I saw 10 httpd
    processes. But for all the subsequent requests, the number of
    processes were between 3-4. This was for a single device on the VLAN.

    I also couldn't find the 'worker' module configuration anywhere.
    So I think httpd is running with default configuration as far as
    threads, processes, connections etc.
    I think, I should be adding the following sample configuration
    somewhere, can you tell me here would this go?

    ServerLimit 16
    StartServers 2
    MaxClients 200
    MinSpareThreads 25
    MaxSpareThreads 75
    ThreadsPerChild 25

    I have turned on the slow query log in mysql and no queries have
    showed up so far, been running for past 3 hours.

    Anything else that I can look at?

    ------------------------------------------------------------------------
    From: [email protected] <mailto:[email protected]>
    Date: Tue, 16 Jun 2015 13:49:42 -0400
    To: [email protected]
    <mailto:[email protected]>
    Subject: Re: [PacketFence-users] Caching for Captive Portal



    On Jun 16, 2015, at 9:35 , Andy A <[email protected]
    <mailto:[email protected]>> wrote:

        Hello

        What's the best way to speed-up the serving of captive portal
        pages to reduce latency?
        Currently the latency of each page is quite high in 7-8
        seconds bracket.



    Hi Andy,
    Before anything you really need to know where the bottleneck is.
    E.g. Improvements to the webserver (for instance) will not help if
    the database is at fault.

    Try to see if the httpd is hitting the maximum number of processes
    it can handle concurrently for a start.
    You may be swamped by what we colloquially call “parked devices”,
    i.e. devices that constantly query the portal even though no one
    is actually going to register (mostly phones).
    Or you may have a single device that is trying to open hundreds of
    connections to the portal.

    If that’s not the case, try to see how long it takes to serve each
    query.
    Apache can log the time per requests.

    Enable the slow query log in mysql.
    Etc.

    Your question unfortunately does not lend itself to a simple answer.
    Each server is unhappy in it’s own way.

    Regards,
    --
    Louis Munro
    [email protected] <mailto:[email protected]>  :: www.inverse.ca
    <http://www.inverse.ca>
    +1.514.447.4918 x125  :: +1 (866) 353-6153 x125
    Inverse inc. :: Leaders behind SOGo (www.sogo.nu
    <http://www.sogo.nu>) and PacketFence (www.packetfence.org
    <http://www.packetfence.org>)


    
------------------------------------------------------------------------------
    _______________________________________________ PacketFence-users
    mailing list [email protected]
    <mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/packetfence-users


    
------------------------------------------------------------------------------



    _______________________________________________
    PacketFence-users mailing list
    [email protected]  
<mailto:[email protected]>
    https://lists.sourceforge.net/lists/listinfo/packetfence-users



------------------------------------------------------------------------------
_______________________________________________ PacketFence-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/packetfence-users


------------------------------------------------------------------------------


_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users

------------------------------------------------------------------------------
_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users

Reply via email to