Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

ionCube PHP Accelerator rocks!


Guest

Recommended Posts

Posted

I just wanted to pass this on to the dedicated server admins...ionCube PHP Accelerator rocks!

 

I was looking into getting Zend Accelerator ($490) to speed up the PHP performance on my server when I found a free alternative. I read up a little bit and installed...which took all of 30 seconds.

 

The performance increase? Holy cow...there is no comparison! Night and day...

 

I don't know how I got along without it installed! It's that much of a performance increase!

 

So, if you are dedicated server admin check out ionCube PHP Accelerator and see for yourself. It's FREE, fast, and stable. Just like osCommerce...

 

*Can you tell I'm excited?* :)

Posted

BTW...can anyone top this site: http://differentsounds.com/catalog/ ??

 

Page Parse Time: 0.028 seconds

Query Count: 8

 

Fully functional (SID prop and all) :)

 

Let's see if someone can top that speed optimization...I'll put $5 to the winner.

 

Requirements: be able to beat the parse time AND query count :)

Posted

what code are you using to set the reference times? this way, can see a before and an after

Posted

In application_top.php this code as the first line of PHP:

define('PAGE_PARSE_START_TIME', microtime());
$debug = array();

This sets the initial start time and also initiates the $debug array for the query count.

 

Then, in includes/functions/database.php change tep_db_query() like this:

function tep_db_query($query, $link = 'db_link') {
#Set $debug global
global $$link, $debug;
$query_start = microtime();

if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
error_log('QUERY ' . $query . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
}

$result = mysql_query($query, $$link) or tep_db_error($query, mysql_errno(), mysql_error());

if (defined('STORE_DB_TRANSACTIONS') && (STORE_DB_TRANSACTIONS == 'true')) {
$result_error = mysql_error();
error_log('RESULT ' . $result . ' ' . $result_error . "\n", 3, STORE_PAGE_PARSE_TIME_LOG);
}

$_start = explode(' ', $query_start);
$_end = explode(' ', microtime());
$_time = number_format(($_end[1] + $_end[0] - ($_start[1] + $_start[0])), 6);

$debug['QUERIES'][] = $query;
$debug['TIME'][] = $_time;
return $result;
}

This stores the query in the $debug array.

 

Next, in application_bottom.php add this code just above the ending php tag:

if (DISPLAY_PAGE_PARSE_TIME == 'true') {
   $time_start = explode(' ', PAGE_PARSE_START_TIME);
   $time_end = explode(' ', microtime());
   $parse_time = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3);
   echo '<div align="center"><span class="smallText">Current Parse Time: <b>' . $parse_time . ' s</b> with <b>'.sizeof($debug['QUERIES']).' queries</b></span></div>';
}
unset($debug);

 

Then, in the admin control panel enable the display of page parse times. Voila!

Posted

Chemo, I was reading up on this ionCube php accelerator and was impressed. Is it true it only supports up to php 4.3.3? I'm running 4.3.8 here.

Posted

From their download page:

 

Often different PHP versions have no changes to affect PHPA. Just pick the build for the PHP release that matches or comes before the version of PHP that you are using.

 

Currently, I running PHP v4.3.9 on an Apache v1.3.33 webserver. Absolutely no problems...

Posted

Zend optimizer is also free :)

Mark Evans

osCommerce Monkey & Lead Guitarist for "Sparky + the Monkeys" (Album on sale in all good record shops)

 

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

Software is like sex: It's better when it's free. (Linus Torvalds)

  • 3 weeks later...
Posted

Chemo:

 

Would you actually place the "if (DISPLAY_PAGE_PARSE_TIME)..." BELOW the "if ( (GZIP_COMPRESSION == 'true')..." stuff? In order to display the COMPLETE time perhaps?

 

Thanks... would be nice if we all use the same scheme here so we can compare.

 

Hey, and thanks for the code and the "optimization thread". Was pretty shocked to find my main page using 98 queries (!). Whenever I'll be finished with my other stuff, there will be some things to optimize... there should be SOME potential for streamlining db access... each and every contrib and hack use their own queries, so I think some thinking (and JOINing) might help.

 

Happy Holidays!

 

M.

I don't want to set the world on fire—I just want to start a flame in your heart.

 

osCommerce Contributions:

Class cc_show() v1.0 – Show Credit Cards, Gateways

More Product Weight v1.0

Posted

I place it as the last bit of code in application_bottom.php to include the GZIP'ing. So, it is a TOTAL time.

 

In reference to the above posts about Zend Optimizer: I just upgraded my PHP version to 4.3.10 (in light of the security issues with 4.3.9 and below) so had to upgrade the Zend Optimizer as well.

 

Without any optimzers (plain PHP parser): page parse time .257 seconds (average of 10 reloads)

With Zend Optimier v2.5.7: page parse time .105 seconds (average of 10 reloads)

with PHP Accelerator v1.3.3r2: page parse time .031 seconds (average of 10 reloads)

 

So, Zend Optimizer + PHP Accelerator = a faster parse :)

Posted

Chemo,

That time isn't that hard to get. These are my figures:

 

Parse Time: 0.03655

Query Count: 8

 

I'm in the process of doing a cookie and url session id compatible box cache which should drop the query count down to even further. I have a totally different layout, different contributions, etc. so I cannot directly compare and I have no intention of going back to a stock layout just to check sorry.

 

But on there page I see the following potential queries:

 

Language - Can be hardcoded

Currency - Can be hardcoded

Tax Class/Rate - Can be hardcoded

Shopping Cart

Categories Box - Automatically cached if cookied

Manufacturers Box - Automatically cached if cookied

Best Sellers Box

Reviews Box

Specials Box

Counter (2)

Sessions (2) - Will not query if sessions saved to disk

Visitors (2) - May be removed

Whos Online (2) - May be removed

Banner Activate (2) - Should be removed to be handled by CRON

Banner Expire (2) - Should be removed to be handled by CRON

 

So that leaves 5-9. The banners are probably hardcoded because I don't see a link to redirect and plus looks more like internal links than banners.

 

Also if they used your page cache they can effectively go with only 3 queries (2 for the counter and 1 for the shopping cart). If the Visitors and Whos Online features are retained then you get 7. IMPO...I think the Visitors provides less information then some of the log analyzers out there so I quickly commented it out.

 

With MySQL Query Caching, PHP Accelerator or MMCache (which i'm using) getting a site down to a 2-3 millisecond parse time isn't that difficult as long as you take some time to review the base code and any contributions you might add. I have another project of a stripped down OSC that's running at 0.01397s total parse time with 4 rotating banners (8 non-cacheable queries just for the banners). If they weren't banners but instead cacheable blocks I could knock off another 0.00522s off the parse time bringing it to a total of 0.00875s (sub 1 millisecond) parse time.

 

And if you add your Page Cache to lower the parse times even more (since now the bulk of page parse time is more comprised from the actually producing html code than querying or loading functions)...there is no speed advantage to having static HTML pages. PHP pages can parse in only a few milliseconds slower than php plus you get to keep the session information in tact and even provide gzip compression.

 

So yes back on the subject...PHP Accelerator, MMCache (eAccelerator) and Zend's Accelerator...should be your best friend(s).

I ♥ PHP/MYSQL/CSS

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...