Any P202 Mods to Make it Faster?

Does anyone know of any mods to make p202 to load it’s links faster? I’m getting a dedi, but would like p202 to redirect faster. It seems like bbrock32 is pretty experienced in modding the p202 script.

I still have yet to try the script he made for facebook, but i bet it’s awesome.

Something I’ve heard was to take out some code which could make it load faster.

User Comment:
These are not exactly mods but here is what I do to keep the redirects fast :

1 – Make sure you use memcached. P202 has built in support for it.
2- Empty your db every 1 million clicks ( will show you how )
3 – Run these optimization commands every day or so.

Empty P202 DB Commands :

truncate 202_clicks;
truncate 202_clicks_advance;
truncate 202_clicks_record;
truncate 202_clicks_site;
truncate 202_clicks_spy;
truncate 202_clicks_tracking;
truncate 202_clicks_counter;
truncate 202_cronjobs;
truncate 202_delayed_sqls;
truncate 202_ips;
truncate 202_keywords;
truncate 202_last_ips;
truncate 202_site_domains;
truncate 202_site_urls;
truncate 202_summary_overview;

Commands to optimize P202 DB :

mysqlcheck -r --all-databases
mysqlcheck -f --all-databases
mysqlcheck -o --all-databases

User Comment:
You’re not going to make it a whole lot "faster", but you will be able to enable to handle more load.

If you can, run it on something other than apache. Nginx, lighttpd, or litespeed will all be able to serve more requests per second than apache.

Also, allow mysql to use more resources. The default config for mysql is pathetic. Try copying the my-huge.cnf or my-large.cnf over the existing /etc/mysql/my.cnf file. You can usually find the other config files in /usr/share/doc/mysql-server-**MYSQLVERSION**/examples/config on debian based systems… or just search for them with "find / -name *my-huge*".

User Comment:

Where do you run those commands? And that erases all the clicks until what date?

User Comment:
The empty database commands can be run from phpmyadmin.
They will delete all clicks / stats so far . However your links / lps will stay untouched.

The commands to optimize the database should be wrote on the mysql command line.

User Comment:
Just trying to make sure I don’t mess anything up. My database size is 3 gb and takes a while to load. Will this speed that up? and how can I keep the stats for the past 2 months?

User Comment:
Another thing I wanted to know is: Is it safe to run the truncate commands and optimize when you are sending live traffic?

I need to clean out my db bad but it would take me a while to pause all of my camps first.

User Comment:
It will definitively speed things up.
You can’t save data from the past 2 months but you can backup the whole database , download at your pc and install p202 on localhost to see the past data.

Yeah I do this all the time. Just make sure you run the optimization commands after that.

User Comment:
@bbrock32 Thanks for posting the tips

One of the upcoming updates we are going to add is easy database management options so you don’t have to do this stuff the hard way.

User Comment:
can u give steps on how to do this. Idont want to lose precious data and correlation’s + I want to do offline analysis on the p202 data. thank you

User Comment:
To backup your P202 database you have two ways :

1) Through PhpMyadmin ( easiest ) :

Click on the database name from the list on the left pane and then click on export and save the sql file on your pc.
You can install p202 on your local pc and use this database to analyze the data

2) Through command line

Connect via SSH to your server and type in this command :

mysqldump -u yourdbuser -p yourp202dbname > p202backup.sql

Let me know if you have trouble exporting it.

User Comment:
I tried running the optimization command lines on PhpMyAdmin

but im getting an error.

"#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘mysqlcheck -r –all-databases mysqlcheck -f –all-databases mysqlcheck -o –al’ at line 1"

any solution to this?

User Comment:
The optimization commands must be ran from the command line, not through phpmyadmin.

User Comment:
of course there is. it’s called CPVLAB

The Article Published IN 05-22-2011 05:15 AM

Share To More ()