About http://dev.piwik.org/trac/ticket/3632

Today I’ve got some spare time, in reality I’ve missed the last train last night and I’ve passed some nice time with homeless people trying to sell me expired ticket ecc ecc…
I was quite tired in the morning
By the way I’ve read how to prepare piwik to make some benchmark, just add 2 lines

But I was skeptic, the php has to be loaded, config file parsed and so on…

So here the quick bench
i5-2400 16gigram no load

ab2 -n 10000 -c 20 "http://stats.wellnessadv.com/piwik.php?actionbla bla bla…
Time taken for tests: 22.160 seconds
Requests per second: 451.26 [#/sec] (mean)
Time per request: 44.321 [ms] (mean)

System Usage
Tasks: 161 total, 8 running, 153 sleeping, 0 stopped, 0 zombie
%Cpu(s): 80,6 us, 18,6 sy, 0,0 ni, 0,0 id, 0,0 wa, 0,0 hi, 0,8 si, 0,0 st
KiB Mem: 16336016 total, 16244128 used, 91888 free, 566360 buffers
KiB Swap: 20477944 total, 49964 used, 20427980 free, 12185328 cached

5818 nobody 20 0 407m 171m 134m S 10,3 1,1 5:51.54 php-fpm
31290 nobody 20 0 296m 15m 8312 S 10,0 0,1 0:00.77 php-fpm
5801 nobody 20 0 409m 173m 134m S 9,7 1,1 5:44.36 php-fpm
5802 nobody 20 0 411m 174m 135m S 9,7 1,1 5:54.32 php-fpm
5805 nobody 20 0 409m 173m 134m S 9,7 1,1 5:46.30 php-fpm
5815 nobody 20 0 415m 181m 135m S 9,7 1,1 5:48.10 php-fpm

/** omissis **/

19539 nobody 20 0 414m 177m 134m R 9,3 1,1 3:58.42 php-fpm
26374 mysql 20 0 4777m 1,8g 8756 S 9,3 11,3 376:59.08 mysqld
/** omissis **/

As you can see mysql is still used… the performance is increased by 30% from the last run, but you have to rerun all the insert later (i’ll do some bench later)

Mysql query is this
Connect stats@localhost as anonymous on stats
Query SELECT option_value, option_name
\ \ \ \ \ \ \ \ FROM pi_option
\ \ \ \ \ \ \ \ WHERE autoload = 1
Query SELECT option_value FROM pi_optionWHERE option_name = 'lastTrackerCronRun’
Query SELECT option_value FROM pi_optionWHERE option_name = 'usercountry.location_provider’

So I think the no_tracking check should be make much earlier, to avoid all the inner logic step and trow them away.

Hello, what do you suggest exactly?

Using a 2 phase method is actually slower…
The inner logic has to be changed.

The easier scenario is a returning visit, just check the config file and then disable the whole piwik.php logic…

As stated here 301 Moved Permanently
the bottleneck is not MySQL, and I’m willing to make al the benchmark you want.
The “offline” technique can be good, but no php parsing has to be involved.

I hope on late monday to post some benchmark timing and callgrind of a tracking_disabled piwik.php and later of a “early” disabled piwik.php

Just a
do your job

on the early line.

I would like to remember that is for simulating just returning visit.

Sorry I do not understand your point or idea.

piwik.php is slow, not mysql.

You don’t gain speed delaying the insert of the data, because executing the script take much time.
Even asking for the image take much time…
You should make a check early in the script, if is the image serve and die(); if the tracking is disabled AND is a returning visit (the id_visit code is present in the GET) just die() ecc ecc.
Monday i hope to make such modification ad insert more data, I will be on the irc channel.