In my setup, flash application displayed in iframe in social network (facebook, vkontakte, ...). Client can send http queries to php script and receive gzipped json object in response. Php served by classic nginx+fpm+mysql stack.
I need somehow calculate the amount of generated traffic (size of response) for each query and measure the query quantities. In the end, I want to get statistic like query:response_size:count. There are at least 100 types of queries, as I know. I'm too lazy to use charles and gather this data manually, is there a more usable way to calculate such metrics?
Will provide any details if neccessary.
Query example:
http://subdomain.domain/application/srv/server.php?session=09d88b10c892fa33a308a40cbe620cdc1382c29ec0c98a3ccaa6fedb55945c7422fdc98501ecb8575d26b&pals=74657,84453,110000,199883,485450,533199,1643902,3763644,8285868,8333492,12415998,25621146,39786498,53680938,65441696,101326628&group=1&user=16604572&sess=*&page=0&pref=&psex=1&lmenu=0&method=user.auth&hash=1452744105&auth=365db256ff2820bf92f0126d2878f1e0
Response example:
{"player":{"expired":1410178378},"time":1410178378,"clan":{"9":{"icon":{"1":[6,1],"2":[11,8]},"created":"1391610111","text":"Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea c","wins":"0","level":"2","name":"This_is_a_name","gold":"100000","gems":"90","leader":"1812347","post":"The megaheader;Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed di","runs":"0","rate":"0"}}}
Well, one way you could get the size of the returned data is just to get the length of the return string.
That would be the size of the response data in bytes.
For example
$.get(
"test.php",
function(data) {
size = data.length;//size is in bytes
$.get("logSize.php", { size : size });//log the size of the response
}
);