Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get a <200ms response with Drupal (without caching)?

The question, simply put, is the one in the title. Is it possible?

So far, my experience with scripting languages is that, to increase performance, you need to cache everything and later just serve the generated HTML files.

That's ok for some use cases, but when you really need to generate a new page in realtime, it's just impossible.

Drupal can take up to 3 seconds (or more!) to render some web pages (PHP execution time, not DB). That's crazy. Completely crazy.

If many projects (like Facebook) are using PHP, obviously the problem is mine. But googling for this problem shows that it's common. Too common.

(Of course I installed APC for PHP. It certainly helps, but PHP is still ultra-slow).

Must I assume this is the reality for Drupal / PHP?

Thanks.

like image 401
Juan Avatar asked Jan 03 '11 15:01

Juan


2 Answers

Short answer is no. But why would you not want to cache?

What do you mean by 'generate a new page in realtime'? Authenticated users (anyone logged in) can see new content right away. Anonymous users may have to wait a little bit (if you are using Boost, for example), BUT, you can always control it, or flush it when new content is added. You should cache as much as you can.

You can install Boost (static HTML files), Memcache, and enable Drupal cache. It's encouraged, especially the last one. You can also run nginx on the server.

You can also try using Pressflow, a drop-in replacement for Drupal that will give you better performance.

http://pressflow.org/

Its been discussed many times.. you can make Drupal extremely fast if you want to. Check out some of the 2bits articles:

http://2bits.com/contents/articles

Utilizing the available methods of caching will help you keep your hosting cost low, instead of throw more hardware on an unoptimized site.

like image 189
Kevin Avatar answered Nov 15 '22 08:11

Kevin


As you say, Facebook uses PHP, and they clearly have reason to need good performance. Their solution was to write their own compiler for PHP called HipHop, which they released as open source. If you're worried about PHP's performance, you should give it a try as it will definitely improve things.

The downside is that it doesn't (yet) cover 100% of the PHP function set, so some PHP programs may not compile. I don't know where Drupal fits into this, but it would be worth trying it out - there's nothing to be lost by doing a test compilation; if its not going to work, you won't have lost anything.

On a similar vein, there is a project in the Drupal community to convert parts of the Drupal Core into a PHP Extension, meaning that some key Drupal functions are then built-in to the PHP runtime as compiled code. See the project page here. But note that this is still in a fairly early stage of development: it's still listed as experimental, and only covers a small number of functions. It might be worth keeping an eye on the project, though.

like image 24
Spudley Avatar answered Nov 15 '22 09:11

Spudley