Jump to content

Performance questions


Recommended Posts

Hi guys,

I am running latest revive ad server, I tuned absolutely everything what I could. Last month my RA serves 382 million banners (hosted on 1 server)...

The thing is, I would like to optimise this even more. Playing with xdebug, I can see in my app this is slow down - the most time takes RA server to process. I am calling via local tag (xml-rpc was too slow).

Here is screenshot of webgrind:

Screenshot_2015-11-03_14.18.45.thumb.png

I got couple of campaigns and banners, for banners I have to use REGEXP match (because no OR condition).

I guess deleting inactive campaigns will not help.

What I can do to improve speed?

 

I saw you offer REDIS plugin, but I am not sure, if this helps in this case (mysql seems not a bottleneck here, I got it on SSD...)

 

 

Thanks

Edited by 2ge
redis
Link to comment
Share on other sites

382MM impressions/month is quite a lot for one server (imagine it breaks down) :-). Lets start from the start, how is your server setup? Do you use php-fpm? What kind of PHP modules do you have enabled? Do you have memcache enabled for the banner delivery cache? Did you disable automatic maintenance?

Link to comment
Share on other sites

Ian, everything what you wrote is true, but I will be more specific:

server info:
FreeBSD 10.1-STABLE #3 r274924M: Sun Nov 23 22:58:10 CET 2014
CPU: Intel(R) Xeon(R) CPU           X5650  @ 2.67GHz (2666.82-MHz K8-class CPU)
real memory  = 25769803776 (24576 MB)
FreeBSD/SMP: Multiprocessor System Detected: 24 CPUs

PHP Version 5.6.13,
php-fpm	active

for php-modules - I got them quite a lot, but I need them. Memcache of course enabled, automatic maintenance disabled (using cron). And using PHP OpCache (no stat on) also... I don't think there is much more optimise from my side. The thing is, the load on this server is not more 10 (24 CPU!), also in my case I don't use GEOIP (it is quite slow), so I really don't know what to improve more...

I guess, there is now way optimise PHP code shown in screenshot of webgrind what I posted.

 

 

 

Link to comment
Share on other sites

well, mysql is running on another box :) 

I was just hoping to get info on methods/functions I see in webgrind, why they take so much time and how possible to optimise them.

I am using quite a lot of conditions via variables for banners delivery (example 'myvar' regex match 'ab|cd|ef' and 'othervar' equals 'this')

I guess, campaigns which are not active are not evaluating - so deleting them will not help.

 

Link to comment
Share on other sites

I'm afraid I cant help you much with that. conditions and limitations of-course increases the load on the box ( has to calculate more with every hit )
Remember that it is an open source project, so you could look (or let look someone) to optimise the code for your specific needs.

Apart from that; I have seen situations where a server of your specs was able to serve around 500MM impresions/month, but it didn't have that much conditions (none) for delivery.

Link to comment
Share on other sites

Hi.


There are always a room for improvements on server side, without code changes. Most probably i can help you with your task (it will involve some changes to your infrastructure, unfortunately i work with Linux only; hosted solution is the best choice). It looks like you are talking about banner delivery time (which is the most important / most loaded one in ad servers). Local tag should be the fastest but it's not usual to use such type because revive adserver and your website should be placed on different servers, if possible. The most used and stable way to deliver banner impressions is "ajs.php", so let's talk about that. In my production environment (rather optimized), but without much work on revive adserver performance, i have the following typical run (in-memory caching enabled) (take in mind that profiling gives some overhead) http://data2.floomby.com/files/share/4_11_2015/1/Uohg07PiKEu2oKPzqeMo3w.png
So generation time is 5,184 microsecs which is 0.005184 milliseconds. It can be optimized more. No idea why parse_ini_file is called (which is most slowest function in this profiling) - probably can be removed. mysql_query is probably can be removed too (but statistics should be disabled for that). Don't know what is "phpSniff" but probably related to statistics. This is a medium-priced server, high-end ones should be even more faster (but more expensive).
For sure this is a very simple html banner without much logic inside and with caching. Perhaps with your case it won't be that fast but most probably i can make it a lot faster than it is now :)

Link to comment
Share on other sites

Thanks for all replies. Well, I am running download server and ad server on the same server. Download server request ad using local tag, and then process it.

I am thinking, if it would help to move RA to another server and run it there as single service.

If yes, I had to call using http - ajs.php on my ad server to get banners, right ? 

In the same time I am thinking local delivery save some overhead to make new TCP connection and so on...

 

 

Link to comment
Share on other sites

I am thinking, if it would help to move RA to another server and run it there as single service.

It may help a little, but i doubt that it can fix your issues completely. The best way to act is monitoring and deep profiling. You need to detect what exactly makes request slow. It may be MySQL queries (just guess), in this case you will need MySQL optimization (SSD is good, but MySQL need care to work fast). It may be php, in this case you will need some refactoring on server side and maybe CPU upgrade (better CPU -> faster execution). It may be some concrete banner / code (e.g. eval) which can be removed. It may be some server (OS / software) issue / regression.

If yes, I had to call using http - ajs.php on my ad server to get banners, right ? 

Yes.

In the same time I am thinking local delivery save some overhead to make new TCP connection and so on...

Yes, local delivery should be faster, but overhead is not much and basically it only affects user side (in browser), from server-side overhead is near zero. You should not worry about TCP connections if you have less than 10,000 requests per second.

Link to comment
Share on other sites

Thanks for really nice help. Well, I think PHP execution what it makes slow (see my first post), it is not database (no slow query...).

To look inside for my scenario.

I got 2 zones.

Each zone got around 200 active banners.

Each banner got this delivery limitation (approx): 

Screenshot_2015-11-05_12.44.46.thumb.png

so, I am checking always only site variable, there is always lang, and then might be some other criteria, this example it is country (I am doing GEO targeting on source server).

I think this it makes really slow, to compare all 200 criteria, CPU load on that server is really high. So I was thinking, if for example "lang" I can pass via "Client - language", it would make things faster, what you think ? Somebody have knowledge how RA executes these limitations ? 

Thanks.

 

 

Link to comment
Share on other sites

To look inside for my scenario.

I got 2 zones.

Each zone got around 200 active banners.

Each banner got this delivery limitation (approx): 

Screenshot_2015-11-05_12.44.46.thumb.png

so, I am checking always only site variable, there is always lang, and then might be some other criteria, this example it is country (I am doing GEO targeting on source server).

I think this it makes really slow, to compare all 200 criteria, CPU load on that server is really high. So I was thinking, if for example "lang" I can pass via "Client - language", it would make things faster, what you think ? Somebody have knowledge how RA executes these limitations ?

 

I am not sure, but most probably delivery limitations is like a simple php code. So basically it should takes same time as comparing few variables with each other and it is very very fast operation, less than millisecond. I highly doubt, that delivery limitations are related to your problem.

Link to comment
Share on other sites

yes, I know what you mean. But if you check my first post, you can see, actually this small PHP code is taking the most time in request. I am experimenting with what I wrote, I will see results later, when server will be loaded.

I am not sure how it is made, but I guess maintenance script compiles all active banners from activa campaigns and create the code, and then using eval() is made comparsion. The thing is, it MIGHT be done, that it is faster with keys. So for example it is more easy (and fast) compare if

$_SERVER['HTTP_ACCEPT_LANGUAGE'] == 'en'

then

$_REQUEST = array(
    'lang' => 'en',
    'variable' => 1,
    'variable2' => 2
);

and comparing these, problem is with the keys are 2nd level, so in that case maybe foreach is used etc....

But it is just THEORY. 

Edited by 2ge
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...