12

I've an already developed and running social website like 'Facebook'.

This website has been developed using PHPFox v3.0.7(which is a social networking platform created in php).

The website functions are working well, no issues with them.

The main, major and serious issue I'm facing with the website is the slow execution speed. For any kind of operation it takes too much time and user has to wait for that much time. This really irritates the user and is affecting the performance of a website.

So, I did research on 'Facebook'- The World's Largest Social Networking Website developed in PHP. If 'Facebook' can execute at rapid speed in spite of heavy user load and continuous operations why can't my site?

First thing is the site is developed using a framework called 'PHPFox' so the entire Database design, caching and all other things have been managed by the framework itself, I can't change the framework's settings but ultimately I want to increase the execution speed of my website.

So how should I achieve it? If you have any best in class solution please provide me the guidance for it.

Any kind of help would be highly appreciated.

Please feel free to ask me any of the queries you have regarding the issue I'm facing.

Thanks.

PHPLover
  • 1
  • 51
  • 158
  • 311
  • 1
    **If 'Facebook' can execute at rapid speed in spite of heavy user load and continuous operations why can't my site? - I suspect they've spent a _little_ more on hardware than you've access to. Also, the database engine you're using can make considerable difference. Given that their default DB driver is just an MySQL one (which is deprecated, it should at the least be using the mysqli interface), I wouldn't hold out too much hope of a stellar improvement. DB info here: http://store.phpfox.com/kb/article/622/using-the-database-query-method – enhzflep Jun 09 '15 at 06:11
  • I have to ask right of the gate what are the server resources? – Brian Jun 11 '15 at 07:54
  • Take a look in this web site: http://hhvm.com/ – rafaelphp Jun 11 '15 at 19:27
  • Here's some info from Facebook itself on how it achieves high performance: https://www.facebook.com/notes/facebook-engineering/speeding-up-php-based-development-with-hhvm/10151170460698920 – lostphilosopher Jun 11 '15 at 19:30

5 Answers5

6

There are several ways you can increase the speed.

  1. Using CDN,
  2. Enable caching,
  3. Using load balancing server,
  4. Enable compression,
  5. Enabling bootstrap,
  6. Optimize database and db driver

You can use the following server speedup method

  1. Enabling mod_deflacte
  2. Enabling memchached
Malay M
  • 1,659
  • 1
  • 14
  • 22
  • 1
    Yu could use things like speedtrap, munin, jmeter to monitor where are the slowest parts of your code. I would also add a few memcached layers her and there, possibly a noSQL database like CouchBase for things that are document related, and if all of that is not enough, then I would probably change the framework altogether. HipHop or Phalcon might be a thing to look at. – PEM Jun 09 '15 at 08:01
3

I have faced the same problem earlier when working on PHPFox and most of the things can be handled from the admin control panel.

By using memcached, i have resolved the speed issue. You can follow the simple steps which are mentioned in the knowledge base of PHPFox and i hope you will find some solution. how-to-enable-memcached

Vidya Sagar
  • 1,699
  • 3
  • 17
  • 28
3

First of all facebook uses HHMV(HipHop Virtual Machine) which is an execution engine for PHP, ie their PHP code is first transformed into intermediate HipHop bytecode (HHBC), which is then dynamically translated into the x86-64 machine code, optimized and natively executed.

Thus everytime you login to facebook ,you just run the highly efficient machine code.

I assume your site do not have HHMV , so here are some few tools & tips to boost PHP running websites,

  1. memcached
  2. cassandra
  3. Optimizing db driver
  4. Using msqli instead of mysql
  5. Using a server with better configuration.
  6. Using minified versions of jquery & bootstrap (ie bootstrap.min.js & jquery.min.js).
Prateek Joshi
  • 3,929
  • 3
  • 41
  • 51
2

Hi In your main question, what you are asking is for the advice to increase the performance of your PHPFox application. Whereas, in the different note section, you are looking for the solution to send the Push-Notifications.

I will be answering you regarding the 'Increasing the performance of your website'.

As you must be aware, performance tuning/optimization is the bigger task. It has various stages as listed by '@Myself Malay'. Some of them can be done quick and others will take time. So you need to know them, prioritize them. For ex: Reducing the requests of JS and CSS files, by making them load using the CDN, can be accomplished quickly. Serving your resources (HTML, CSS, JS) in compressed form (gzip) also can be done quickly.

Optimizing your queries will be time consuming. Enabling Cache should be quick. If you want to establish the load balancers then it will take some time.

Here, I am adding some reference links regarding the PHPFox, which will help you.

  1. http://www.ipragmatech.com/phpfox3-performance-xcache-apc-memcached.html#.VXkzXt93M_M
  2. How to optimize your database tables in PHPFox
  3. Speedup PHPFox V3
  4. PHPFox - Optimization Settings

Note: Some of the tweaks may require the modification of the core files. Be careful, while doing so as they will make auto-update very difficult. Always take your code and DB backup during modification to your core files. Make a document about the changes you have done as which files, where why etc, which will help you to re-apply all those changes again, in case of updating your code to new version.

Below, I am adding some of the links, which will help you in understanding the Performance Optimization to the next level

  1. Books for Building Scalable Web Applications? (DB Performance/Tuning, Networking, General Performance, etc.)
  2. Scalability and Performance of Web Applications, Approaches?

My personal favorite book is: Scaling PHP Applications by Steve Corona. This book is the best reference ever available for the PHP Developers.

Eventhough I am not able to give any direct solution to your problem, hope this helps upto certain extent. All the best :-)

Vinod Tigadi
  • 859
  • 5
  • 12
1

First of all, stop comparing your Phpfox site with Facebook. Facebook has hundreds of thousands of programmers working day and night to keep the performance up. It is a horrable truth that PHP is a slow server side scripting language. If your site improves, it's performance goes down. Fortunately, there are some tools available that can be used for increasing the overall performance of your website. Some of them are Memcached, Cassendra, Varnix etc. You can use CD networks to serve data faster. Choosing a good hosting server also helps to make your site ready for heavy traffic. Facebook uses over 100 unique technologies to keep the site going with a respectable speed. Hiphop PHP is a technology that was developed by the company itself and is used to compile PHP scripts faster than any native C++ compiler. Hiphop makes PHP Codes to execute 30-50% faster. Well, HHVM is an alternative to Hiphop PHP and is available for free but requires nginx. Think again, moving from Apache to nginx is not a good decision if you are just a beginner.