SunJordan / ezstats

Automatically exported from code.google.com/p/ezstats
0 stars 0 forks source link

CODE SUBMISSION: Serious performance impact on website (ezstats2_bf3 Joomla plugin) #202

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Please describe the bug:

Actvating the ezstats2_bf3 Joomla plugin, results in a
massive performance drop of the whole web site.
On my site it was approx. factor 20 slower!
(Depending on how many other modules/components are displayed.

Your version of ezStats:
v0.91

The URL to your website:
N/A

Explanaition and solution:

The current logic in the plugin is:

1. Fetch the stats html from ezstats
2. IF the placeholder can be found in article content, replace it by the stats 
html

This is bad logic, because the fetch is ALWAYS done, even if no placeholder is
in the current article. To understand this, one must know, that Joomla invokes 
the onPrepareContent method of any activated content plugin for ANY content 
module or component to be displayed on the current frontend page. This means 
for example:
If, on the frontpage, there are two side bars with each 5 modules plus a center 
area, containing 10 articles. The plugin is called 20 times for that single 
page. Of course, this results in fetching the stats html 20 times - even without
displaying it.

The correct logic is:
1. Search for the placeholder in the given text
2. IF - AND ONLY IF - the placeholder is found, fetch the stats html and perform
   the replacing operation.
3. Use Joomla's default caching mechanism to reduce the fetch operations 
further.

I implemented that (almost a rewrite). The complete plugin code is attached.
Note: The SSL-related code from my earlier report (#200) is already in there as
well.

-Fritz

Original issue reported on code.google.com by felf...@gmail.com on 12 Feb 2013 at 3:42

Attachments:

GoogleCodeExporter commented 9 years ago
Forgot to mention:
The new code also adds rudimentary error handling (which was completely missing 
before), by replacing the placeholder with an error message if the connection 
to ezstats fails.

Original comment by felf...@gmail.com on 12 Feb 2013 at 3:47

GoogleCodeExporter commented 9 years ago
Hi felfert!

Thank you for your work! I think it will be recognized from all ezStats users 
with Joomla out there :)

The problem for me is, I had no knowledge about any CMS I support with ezStats, 
so the plugins are highly try-and-error-work. With not-optimal results in 
complex softwares ;)

I will add you plugin to ezStats this week. Regards, ezzemm

Original comment by ezzem...@googlemail.com on 12 Feb 2013 at 6:20

GoogleCodeExporter commented 9 years ago

Original comment by ezzem...@googlemail.com on 26 Feb 2013 at 8:45