Tweaks to resolve xcache and fastcgi issue for socialengine

xcache-performance-Thumbnail

We have been constantly working on performance optimization of social community based on socialengine platform. The community was optimized by fine tuning Webserver (Apache) and database (Mysql) along with the caching(APC). Our client was really happy with the performance of his social community website.Client’s community is amazing and becoming very popular (growing 1000+ users/week) so we have to fine tune the site further in order to take up the load of growing users. So we decided to boost the site using more optimized alternatives.

SocialEngine Performance with Xcache and fastcgi

  • Authentication issue with xcache using fastcgi on apache2
  • Simple hack to resolve the issue

We configured the apache server with fastcgi module and powered it with the alternative FastCGI processor manager PHP-FPM.Socialengine community performance improved and was able to take up 200 concurrent users without any glitches or without compromising the loading time. We decided to replace the APC with Xcache(1.3.2-2) as later caching performs better than the earlier caching solution. Please feel free to take a look at our previous blog which helps you to install APC, Xcache and MemCache for your socialengine.

Social Community had no issues once it was configured with Xcache but there were issues while editing the language phrases in the Admin control panel.The page kept on prompting for the authentication for Xcache Administration even if we entered the correct credentials. We even tried to set the authentication flag(xcache.admin.auth=off) but it kept on prompting for the authentication. We found the temporarily work around to resolve this issue by putting socialengine in development mode while making the changes for phrases. Well the issue was that the community have many online users all the time and putting socialengine on development mode would have affected the site’s performance.

So we decided to dig further and found that the xcache, for some reason, doesn’t validate the credentials for fastcgi module. We found a little post on google in which some user mentioned the hack to get rid of the Xcache authentication. So we wanted to share that with you guys as well.

You need to download latest xcache from the site (Assuming you already have installed Xcache)

yum remove php53u-xcache
wget http://xcache.lighttpd.net/pub/Releases/1.3.2/xcache-1.3.2.tar.gz
tar xzvf xcache-1.3.2.tar.gz
cd xcache-1.3.2
vi xcache.c

and change the code from

/* auth disabled, nothing to do.. */
        if (!XG(auth_enabled)) {
                return 1;
        }

to

/* auth disabled, nothing to do.. */
        if (1 || !XG(auth_enabled)) {
                return 1;
        }

Once you are done with the changes, then you need to recompile and install it again
phpize
./configure --enable-xcache
make
make install
cd /etc/php.d/
mv xcache.ini.rpmsave xcache.ini

Now you need to add basic authentication in the apache configuration file to make Xcache administration more secure. Please google and found a way to add basic authentication.
Feel free to send us your questions or issues related to socialengine, we would be happy to answer them.

It is possible to do performance tuning by yourself, or getting developers to do this. However, in our experience, the community owners are really more focused on making their community an engaging experience via functionality or graphics. Similarly, most developers can write PHP code, but very few have the experience of various tools for improving performance. One of the solutions we thought was to bake this optimization right into the hosting, so we have teamed up with Acenet hosting to provide you hosting for SocialEngine and Phpfox with built-in PHP, web server and database performance enhancements. Custom optimization may be required when your community grows huge, but that is different for everyone and we will continue to provide it as a separate service.

Tweaks to resolve xcache and fastcgi issue for socialengine was last modified: May 3rd, 2016 by Kapil Jain