openfisca / openfisca-web-api

[DEPRECATED] Web API for OpenFisca
https://www.openfisca.fr/
GNU Affero General Public License v3.0
13 stars 11 forks source link

Piwik tracking #141

Closed sandcha closed 7 years ago

sandcha commented 7 years ago

Connected to #138

Sets configuration to activate piwik tracking on every endpoint. Logs friendly messages on tracking option. Adds tests for multiple requests sending.

fpagnoux commented 7 years ago

Test 1

Average (over 5 tests) for 200 /api/1/parameters calls, each run 5 times with the command:

time (for i in {1..200}; do; curl  -o /dev/null -s "http://localhost:2000/api/1/parameters"; done;) 

With tracking: 10.0308s Without tracking: 9.984s Overhead: +0.46%

fpagnoux commented 7 years ago

Test 2

Average (over 5 tests) for 200 api/1/calculate calls, each run 5 times with the command:

time  (for i in {1..200}; do; cat test.json | lwp-request -m POST -c application/json http://localhost:2000/api/1/calculate > /dev/null; done;)

Content of test.json:

{
    "scenarios": [{
        "test_case": {
            "households": [{
                "parents": ["ind0", "ind1"]
            }],
            "persons": [{
                "id": "ind0",
                "salary": 15000
            }, {
                "id": "ind1"
            }]
        },
        "period": "2017-01"
    }],
    "variables": ["basic_income", "income_tax"]
}

With tracking: 24.2s Without tracking: 24.4s Overhead: -0.8%

Interpretation: the overhead introduced by tracking is not significant, and is not visible due to the variance of the calculation time.