-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finish Live! plugin: bugs and small enhancements #1120
Comments
http://www.wpwp.org/ -> nice idea for live statistics |
This wordpress stats plugin looks nice indeed: http://www.wpwp.org/whatis/ the spyview with the google maps is interesting. |
(In [1803]) refs #1120 - suppress broken image link where no search engine icon defined |
Now added the actual Version: open issues: Live Widget
Visitor Log
|
Attachment: |
(In [1868]) refs #1120 - merged from Live.zip as there were too many conflicts with piwik.patch against the svn trunk |
Thomas: please "svn up" and sanity check my merge. Thanks. |
Performance issues
To understand the problem, you can enable mysql slow query log and try to generate the Live! on a test website with 50,000 visits per day, generated using the visits generator. To solve the issue, we can either: add new INDEXes on the log_ tables (not really something we would like to do), or we can denormalize the log_ tables so that we can fetch the data without doing JOINs. |
Attachment: |
Performance issues We need an new index: ALTER TABLE So i added and replaced the live.zip with the actual stand of the svn. |
jr-ewing, adding a new index is possible but very heavy update task. Can you please document why this index is needed and why is is sufficient to make Live! plugin work fine on high traffic website? for example, can you post mysql slow logs before and after the INDEX, details of the website you are testing against (how much traffic today, yesterday, the last N days, etc.) Thanks! |
Reported on the forum: when the Live widget refreshes, it reverts back to displaying visits from idsite=1, while the rest of the dashboard is displaying a different idsite (e.g., 2). |
Problem: Adding an index to the single col visit_last_action_time may solve the problem. For testing, I used a simplified SQL-Query in a simplified test-case (query cache off / flushed): ("SELECT * FROM Testing results:
Then I added an index to visit_last_action_time (ALTER TABLE
A deeper view in this explains, why this key changes the query times so much: With an index on visit_last_action_time, MySQL changes the query-type to "range" and uses the visit_last_action_time-index for the query. So it doesn't fetch any other rows that aren't needed in the result set. A lot of data overhead could be saved here to speed the query up extremely. Cheers |
A deeper look at the problem seems to be tracked down to this (extracted Query): ("SELECT piwik_log_visit.* , piwik_goal. These multiple Joins are extremly expensive for performance because MySQL is using nested loops. In this case, MySQL joins over a Million rows (using a tmp table) and then limits them to the ten highest idvisit-id's. This is a huge piece of data to process. As we can't know how large the tables will grow in a high-traffic environment, we should avoid table joins here but rather use a stepwise approach: fetching the relevant idvisit-id's from the first table, query them from the second one and so on. So it will be possible to build an array of correlated data and it's mich faster. Cheers |
Replying to peterb: Hello Peterb, best regards Tom |
Attachment: |
Attachment: |
Note, the work on the timezone see #5476, will add an index on ( idsite , visit_last_action_time ) which should help with Live! performance issues correct? the new index will be available in the next public release (likely 0.6) With this new INDEX, are there still performance bottlenecks on high traffic websites? |
Actually, the exact INDEX is likely to be
but we will remove the existing INDEX piwik_log_visit.visit_server_date - will this pose some problem to Live! plugin? |
Replying to matt: Yes the index will help enormous
piwik_log_visit.visit_server_date is not using by the live plugin. |
but it would be useful to test it on the Piwik Demo |
2.4s sounds reasonnable, but still quite slow; is the INDEX fully hit during the query? Also, would it be possible to add the request throttle, so that you only send one request at a time, and not queue up requests on the server? Currently, I believe that if the request hits the DB and takes 60s to return, the Live! plugin will queue up dozens of requests, killing the webserver. What do you think? |
We need one Request to get
For all these Requests we need the index because we only need the last visitors. Point 1-4 is repeat every 20 Sec. So i dont know how to get a good performance for so many data. |
The new INDEX was committed to trunk: see http://dev.piwik.org/trac/changeset/2006#file14 |
jr-ewing, my comment meant that the Javascript should only send the request to the server if the previous AJAX request was received. You could add a test in the response handler that would set a flag, allowing other AJAX to trigger. If the flag is not set, it means that the AJAX request wasn't received yet and no other requests should go to the DB until the first request was received. |
Attachment: |
Attachment: |
(In [2019]) refs #1120 - commiting update from Live-0.5.5.zip |
I enabled Live! plugin on piwik.org/demo and it broke down the server. Here is the mysql Slow query analysis: Tab Visitors>Visitor Log
Fix
Live! Widget Queries now run fast, except the first one that is the same as the one above. fixing this query should therefore fix performance issues with the Live! widget. I'm not sure whether to limit the Visitor log to the last day, or more. Users might want to access logs from older dates too. Maybe the query for the Live! widget only should restrict to the last 24 hours, when the visitor log LIMIT 1000 would limit to the last 7 days? The proper solution would be to have the visitor log fetch each day separately automatically when clicking Next or Previous (and have the last date as a parameter). |
(In [2097]) Refs #1120
|
Attachment: |
(In [2787]) Coding style, Refs #1120 |
(In [2788]) Modification for new Minify-API, Refs #1120 |
(In [2808]) Refs #1120 |
Some great progress has been made on this widget by Peter. Postponing next requests to post 1.0... |
Attachment: Show goal details per action; Highlight action field in the row, where conversion happened; + Minor Updates |
(In [2832]) Refs #1120; Show goal details per action; Highlight action field in the row, where conversion happened; + Minor Updates; Must refresh assets; |
From email: A very cool UI improvement for the same page could be to display the whole referrer link but only the domain-name in black, the URI in light grey beneath. |
(In [2865]) Refs #1120 |
Idea from forum: in visitor log, would be interesting to see a link for returning visitors that would show all previous visits. |
I'm working on adding customizable icons to the Visitor Log - basically, if a specified regex matches the URL, use a specified icon instead of the default. This can be set up to display the main types of pages on a site at-a-glance or to highlight key pages. I'm doing this inside visitorLog.tpl. Couple questions - first, where should I be storing/loading the configuration from? Also, and more importantly for this ticket, what needs to be done to make this something that could be rolled in to the core plugin? |
Excuse me, that should be "inside liveVisits.tpl" - oops. |
ian, I would propose something around adding a hook that would modify the table of visitor details, at the end of getCleanedVisitorsFromDetails ? |
(In [3331]) Fixes #1794, Refs #1120
|
(In [3332]) Refs #1120
|
I thought to reopen this ticket by detailing an improvement / optimization that can be done (by moving count() functionality into SQL query):
a) From "SELECT " . Piwik_Common::prefixTable('log_visit') . ".idvisit" to "SELECT count(" . Piwik_Common::prefixTable('log_visit') . ".idvisit) AS count"
a) From "return count($visitors_halfhour)" to "return $visitors_halfhour[0]['count']" That's a huge difference, unless I'm missing something and this functionality is used also somewhere else (in that case I'd suggest creating separate functions for counting visits and pageviews and fetching those data). |
Can you attach an actual diff (i.e., "svn diff") to #1839? |
Replying to eistrati: Yes, where the view is only displaying the number of visitors, it would be more efficient to use a SQL query that COUNT()s. However, changing that private method in API.php changes the semantics of the Live API. |
The Live! plugin is now bundled in Piwik core but disabled by default. Here is the list of bugs or changes that we would like to address for a public release:
Live! widget todo list
Bugs
Visitor log
Fixed bugs
slightly highlight visitors which converted a goalthe top table "Today / Last 30 minutes" shows a cursor on hover but is not clickable: it should show the normal pointer.see Live! widget does not show correct number of visits for 'today' #1375the CSS is not applied in Safari, the table displays black and white (Tested in Safari5 [sic])the top table "Today / Last 30 minutes" shows a cursor on hover but is not clickable: it should show the normal pointer.referer URL could be clickable in the visitor logthe Visitor log should display icons for browsers, search engines and OS.the icon for returning/known visitor takes up one row for each visitor; it could maybe be written after the browser/OS icons?there could be a link "more" that when hover, a tooltip is displayed with the extra information about the visitor: the IP (rather than displaying it by default), the Time on site, etc. The code for the existing tooltip can be used (the blue tooltip used when page names are too long in the Piwik Page reports)show the goal icon http://piwik.org/demo/themes/default/images/goal.png when a goal is converted. On hover, show the tooltip with the goal name, the URL where it was triggered, the goal revenuefor outlinks, use a out click icon, eg. http://icons3.iconfinder.netdna-cdn.com/data/icons/tango/16x16/actions/system-log-out.pngI noticed that the code in the API wasn't refactored and added some TODOs there.if I enable the plugin on piwik.org, it is very slow - did you have a chance to test the plugin with a big Piwik installation? I think there are some performance issues.the search box doesn't seem to do anything, should it be removed?idem for the graphs buttons and the advanced table button, they should be removeddeduping visits doesn't work all the time. If you try on piwik.org/demo to add the Live! widget, and wait for a while, you will see the same visits being displayed again and again.See original ticket at #44
Keywords: visitor log, live plugin
The text was updated successfully, but these errors were encountered: