Ali
Ali

Reputation: 7483

Zend Framework Performing Slow

I'm working on a community based website using zend framework - but its so slow it takes a while for pages to load. I would like to know what aspects of the zend framework should I look into to ensure it runs much faster.

Any tips and help would be greatly appreciated :)


Nice advice - I took upon the database and indexed it from scratch - there werent any indexes to start with :\ but anyway the speed has improved a bit but its still rather slow. Is there anything else that I must be keeping an eye on right here?

Because I'm just assuming its something to do with the framework as when I first ran basic tutorial projects made using the framework - they were a bit slow as well.


Nice tips - had a look at the zend performance guide article. I'm not so sure where to put the code for caching table metadata though :( [sorry for sounding like such a noob here] as mentioned at this link

Upvotes: 8

Views: 12782

Answers (14)

hevi
hevi

Reputation: 2716

I had a very similar problem, it was taking me 10 seconds to load a single page while working on my local, using http://localhost/MY_WEB_SITE. By chance I tried http://127.0.0.1/MY_WEB_SITE and it worked real fast(almost instantly). I am not sure what the problem with using localhost is but it worked for me (btw I am on windows 7, checked system32/drivers/etc/hosts and localhost is defined there). so instead of localhost, using 127.0.0.1 might be a solution for you as well.

Upvotes: 0

krakle
krakle

Reputation: 11

If you didn't have any INDEXES in your Database to start with then I'm sure there are other things you are doing greatly wrong!

Anyway...install APC to cache your opcode. This will drastically improve execution time. Most Frameworks have huge overheads due to the massive amount of scripts that need to be included in your application. APC will literally solve that problem. FastCGI can also drastically improve performance. So can persistent database connections (assuming FastCGI is installed and working).

Upvotes: 1

Brent
Brent

Reputation: 1

http://www.zend.com/webinar/Server/webinar-Magento-Performance-Optimization-20090709.flv

watching their free webinar now, they show a lot of the solutions people have mentioned in this thread.

Hope this helps!

Upvotes: 0

Bill Karwin
Bill Karwin

Reputation: 562310

Regarding Zend_Db_Table metadata caching, you should configure the cache in your bootstrap and add it to the Zend_Db_Table_Abstract class as a static property.

(Similar to the way you would open a default database adapter and set it to be the default adapter for all Zend_Db_Table objects.)

There's a code example of configuring a default metadata cache in the section of the manual you linked to. This would go in your bootstrap.

Upvotes: 2

ali
ali

Reputation:

http://www.nabble.com/Caching-of-MVC-and-other-ZF-components-td15576554s16154.html

I guess we'll have to wait for PHP5.3 to be released and then hope we can use it on a production box. :)

Upvotes: 0

Boris Guéry
Boris Guéry

Reputation: 47585

Take a look here:

Performance Guide on Zend

Zend_Log which can log & trace your application

Upvotes: 3

PeterV
PeterV

Reputation: 2882

Agreed with the database comment. If your site is slow, it is most likely NOT a Zend framework issue, and most likely a database issue.

Upvotes: 1

LapTop006
LapTop006

Reputation: 512

If you can be on the same LAN as the server (at least for testing), then you can verify your profile (somewhat) from a client.

If it's a single machine, the most likely cause for slowdowns is memory issues (something using too much, or too little main memory), followed by horrible DB queries.

A PHP opcode cache always seems to help, also remember to disable "atime" (noatime mount option on *nix, a registry change on Windows) to avoid expensive disk writes.

A decent article on more Zend specific things is: http://till.vox.com/library/post/zendframework-performance.html

Upvotes: 8

Mischa Kroon
Mischa Kroon

Reputation: 1772

Most performance issues on the web are database issues, always start looking at the database side of things before moving on.

It might be that there are a lot of database calls made where you can suffice with fewer calls, indexes not placed on the correct columns.

These are the things which usually slow things down.

Upvotes: 6

Silfverstrom
Silfverstrom

Reputation: 29322

You should check out the official Zend performance guide.
There are a loot of tips on howto tune up the speed of Zend, most of them are about reducing the ammounts of files zend loads at startup.

http://framework.zend.com/manual/en/performance.classloading.html

Upvotes: 2

Joeri Sebrechts
Joeri Sebrechts

Reputation: 11146

The only way to know for sure where your bottlenecks are is doing deep profiling.

I use xdebug, combined with kcachegrind (part of kde for windows). It generates full call traces for every PHP script that is executed, which you can then inspect to find out which functions are taking up most of the time. No code changes necessary, so you can easily profile third-party libraries like Zend Framework.

Upvotes: 20

David Snabel-Caunt
David Snabel-Caunt

Reputation: 58361

Definitely install APC as it'll probably give you the biggest performance gain (2-4x) for the least work. I'd also recommend that you take a look at the Performance section of the reference guide.

Zend_Cache can be used with a lot of the ZF components to speed them up, as well as with your own data.

Upvotes: 6

Emil H
Emil H

Reputation: 40240

Install APC on the server. Opcode caches eliminate a lot of the overhead caused by frameworks. You can generally do this by simply running

pecl install apc

on the server.

Upvotes: 7

Rick J
Rick J

Reputation: 2703

The most obvious one would be zend_cache

Upvotes: 3

Related Questions