Alexandr's blog

Settings optimization.

GPix design implement cell per option philosophy and this require to run database each time when I add new option.

So, today I finish to test philosophy 'row per option'. I just tested code which use actively options table with new option 'timezone'. So, to add new options I will need to add html code only. This mean that alter table query will not be required.


You Tube mod

Release for YouTube mod can be accessible via phpLD official site only.

This release contains fixes for problem with empty video items.

I am sure phpLD core team will update file on official forums.


optimization with memcached - is it simple to implement?

memcached is service which provide memory cache storage. It can provide access to cached object via network and it is extrimly fast!

memcashed pecl module is a way which can be used to access cache storage. How it work? It more complicated instead Cache_Lite, but it is fastest. This fact can be explain: Cache_Lite use file system to store cache objects.


PEAR::Cache_lite - speed, simplicity, security

One way to speed up web application is to lower database usage. Databases designed to provide very fast manipulation with data in files. Often developer use databases for everything and store session data, user files. This action make tables big and database server work slowly...


site optimization cases

Ever site have content for cache or pregenerate.

Why cache need to be part of optimization? - if you know what you do and how it is very fast way to lower server load. So, after load is lowered you will have time to think about logical optimization ;)

What we can cache?

  • content
  • sql results
  • functions results
  • logical results(which isn't design as separate functions)

GPix 1.3.3

next features implement for this release.

  • "Remember me on this computer" option for admin
  • order continue functionality after user register/login
  • back link checker
  • multi get/bill, get more that one region per grid functionality

I get more requests for "back link checker", this improvements will be implemented in next version.
Thanks for who help for this release.


Fast file transfer with pseudo HTTP server

Time to time I need to transfer site from server to server very quickly and have not common solution for this, because I have permissios.

Solution is to use http server if you have this one of server with backups or use netcat.
On server side I run

nc -l -p 8080 < mybackup.tar.gz

netcat -l -p 8080 < mybackup.tar.gz

and now can use wget, curl or browser for this url:

if you sent link to client it will best to do little more:

(echo -e "HTTP/1.1 200\nContent-Disposition: attachment; filename=mybackup.tar.gz\n
Content-Type: application/octet-stream\nConnection: close\n"; cat mybackup.tar.gz ) 
| nc -vv -l -p 8080


server security for sessions

most of PHP application use session module. Commonly to provide user authentication and most of hoster providers store session files in /tmp directory. Session files from all users/sites at one dir, it is big security risk!

Looks like /tmp is shared between users and used to store authentication information, really bad idea.

Session module allow to change default path for session files (configurable is strong PHP side), so it simple for webmasters and PHP coders to solve this problem, just need to change session path like this:


ini_set('session.save_path', '/home/your_own_dir/tmp');


cvs diff usage

Some Joomla and Mamaba solutions is so big. I have not problem with size - I just add new disks to my server.
I use control version software for all my projects (SVN or CVS) and it is very easy to share my work with another coders or track what I did here before year(yes, I provide support for all my projects).

So, common problem which I take latest weeks is that I have big applications and just export:

  cvs export -r release_X_Y project

Produce 30-50 megs, this take time to upload. So, I just put little optimization to my work and get only patches:
cvs diff -N -c -r release_X_Y -r release_X_Y > diffs

upload patch and apply it to existing project is good way to spare time


what is PDO?

many clients ask me why I suggest to use PDO as part of optimization

it is very simple
PDO structures is native PHP drivers, which mean that was designed and optimized for PHP

Just image, libmysql use buffers and PHP interface use buffers. This mean that functionality is doubled! It is absolutely normal step to remove libmysql as layer. As part of server optimization this step require MySQL 4.1 as minimal version.

At the end, migration from libmysql usage to PDO save up to 40% server resources!

Syndicate content