> Hi All,
>
> I'm new to uwsgi and thus far am loving it!
>
> I have 2 quick questions:
>
> [1] Is it possible to share php session state accross multiple caches
> (as in the single node cache2 example for the php plugin) using the udp
> server nodes/sync directives?

theoretically yes, but i would avoid it, as on high load the sync could
take too much time. You wrote you have a shared storage, why not using it
for sessions ? Eventually you can have a shared cache (but i ensure you
that redis became more efficient than uWSGI cache once networking is in
place)


>
> [2] Is it possible to load a particular directive based on the servers
> host name in the config file?
>
> For example I have three servers, node[1-3], ip's: 1.1.1.[1-3] and
> assuming question [1] above is doable, is it possible to have something
> like the following in a single uwsgi ini file definition
>
> [uwsgi]
> plugin = php
> <snip>
> if (hostname) == node1
>      cache2 =
> name=session-cache,items=8192,blocksize=64,udp-server=1.1.1.1:10000,nodes=1.1.1.2:10000;1.1.1.3:10000,sync=1.1.1.2:10000;1.1.1.3:10000
> if (hostname) == node2
>      cache2 =
> name=session-cache,items=8192,blocksize=64,udp-server=1.1.1.2:10000,nodes=1.1.1.1:10000;1.1.1.3:10000,sync=1.1.1.1:10000;1.1.1.3:10000
> if (hostname) == node3
>      cache2 =
> name=session-cache,items=8192,blocksize=64,udp-server=1.1.1.3:10000,nodes=1.1.1.1:10000;1.1.1.2:10000,sync=1.1.1.1:10000;1.1.1.2:10000
>
>
> In the above I am trying to achieve a specific cache2 declaration based
> on the host name of the system.


probably i would add more sections in the ini file:

[base]
... common options ..

[node1]
... options of node 1...

[node2]
... options of node 2...

then uwsgi --ini file.ini:`hostname`

btw in 2.0.6 and 2.1 branch the if-hostname logic has been added:

[uwsgi]

if-hostname = foobar.local
    socket = :4041
    socket = :4042
endif =

if-hostname = foobar2.local
    socket = :4043
    socket = :4044
    print = i am the %(_) node
endif =


in addition to this remember that the magic var %h contains the hostname

-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to