May 28, 2008

Eight performance tips for your TYPO3 web site

Increasing performance of a TYPO3 web site is a task that many large companies or freelancers face from time to time. TYPO3 is a great, flexible and powerful framework with amazing possibilities and unlimited expendability. But everything has its costs. TYPO3 may be slow if not configured properly. This article gives 8 tips to improve TYPO3 performance. It requires that you have administrator (root) access to the web server. If you use shared hosting, there is very little that you can do. Read on.

Tip #1: disable everything that you do not use

The very first thing to do is to make your system lightweight. There are certain costly TYPO3 features that make TYPO3 slow.

Firsts, disable completely any TYPO3 built-in statistics. They write information to the database on every page display and it slows down your web site a lot. Especially if you use MyISAM tables with my SQL (see tip #4 about tables). The more visitors you get, the slower the site will work if you have statistics enabled. Use Webalizer, Google Analytics or any other tool that works outside TYPO3. Personally I prefer first two. Webalizer gives most realistic statistics because it operates using web server logs. Google Analytics can create sophisticated reports that help you analyze how good your web site is doing.

Secondly, remove any unused extensions. Some of them provide hooks that executed for every page view. Others do complex actions during TYPO3 initialization phase. Even the simple operation of registering plugins takes time! So get rid of anything you do not use. Why do you need that 50 extensions uselessly running if you actually use only 5?

Tip #2: use optimisations provided by TYPO3

This is a Backend optimization tip. You can speed up TYPO3 Backend by 100% (or even more) if you rename several files supplied with TYPO3. These are _.htaccess files that enable client side caching. There are four of them:

Just rename them from _.htaccess to .htaccess, clear browser cache and try your new faster TYPO3 Backend.
Tip #3: do not use indexed_searchDo not use indexed_search for searching web sites until it implements FULLTEXT indexing. FULLTEXT indexing should be faster than current way. But currently indexed_search is not suitable for sites with more than 100 pages. It is terribly slow and puts huge load on the TYPO3 database. Remove it and you will notice how server load drops and performance of web sitre increases.

What to use as replacement? The easiest is to use Google web site search. It can be customized for your web site look and feel. If you do not like to use Google, try mnoGoSearch. It is integrated to TYPO3.

Tip #4: use InnoDB for database tables

InnoDB is one of database engine types provided by MySQL. Its advantage is that it allows simultaneous read and writes. By default MySQL is configured to use MyISAM, which locks the whole table if anyone write to it. Imagine what happens if one user is browsing one page and it is being stored to cache tables. It means none of other users can browse the site in the same moment. MyISAM will block them until write process completes. And writing is not really quick process, especially if table is large. InnoDB is a solution here: it will allow one user to wite and another to read. No delays. Cheap!

But do not tend to make all tables use InnoDB. InnoDB is an advantage for tables that are read and written simultaneously. But MyISAM is better for tables that are mostly read. TYPO3 already contains instructions to MySQL to create tables using the most optimal engine for them. The only thing that you need to do is to enable InnoDB in MySQL.

Tip #5: do not use persistent connections

Do not use persistent connections to MySQL. Firsts, they are not really faster than regular connections. Secondly, resource associated with connection is freed only in two cases: it is freed explicitly in the code or when connection is closed. So if developer forgot to free resource, it will hang alive until connection is alive. This eats memory and eventually may cause swapping on the is level, which always decreases performance. So, go to Install tool and check that you do not use persistent connection. If you are developer, the best you can do is to ensure that you call proper functions to free MySQL resources.

Tip #6: optimize MySQL

This is a large topic. Every server is different and needs different settings. Even if hardware is the same, sites are still different, data is different and it may need tuning. Buy a good book about MySQL optimization and read it. Personally I recommend “High performance MySQL” by Jeremy Zawodny. He is the guy who was hired by Yahoo to optimize their servers. And he did it perfectly. He really knows his subject. The book does not have ant unrelated words, it is completely about the topic. By it at German or UK Amazon. It is worth buying.

Tip #7: do not use bad extensions

There are certain extensions that should be avoided. They truly kill performance of TYPO3 web sites. How do you recognize such extension? After downloading it, search the file system for “set_no_cache”. If found, avoid this extension at all costs. It is badly programmed and it is not for you. Search for alternative. You deserve better extension.

Tip #8: find your own techniques

The tips above are generic and applicable to any server that runs TYPO3. However your server is as unique as mine. So watch how your server behaves. Try various ways to optimize it. It pays back.

What if I am on shared hosting?

Find a better dedicated hosting, they are not that expensive now. Or find a specialized TYPO3 hosting. Otherwise you cannot really improve the performance of your web site. You still can use tips #1, #3, #5 and #7 though.

Good luck in optimizing your web site performance!

No comments:

Post a Comment