Performance

1,033 views
Skip to first unread message

dkornishev

unread,
Dec 1, 2009, 8:24:27 PM12/1/09
to redbeanphp
Well, initially I only benched RedBean for reading...yesterday I was
observing write speed...and was unpleasantly surprised.

Today I ran a few tests doing same kind of update/insert using plain
PDO and Redbean and the difference is almost 20 times!

I have no idea what could cause it, typically I/O by far dwarfs
execution times.

dkornishev

unread,
Dec 1, 2009, 8:32:10 PM12/1/09
to redbeanphp
Ok, looks like I am wrong. Actual I/O takes ~40ms (I placed measuring
statements in QueryWriter).

It seems incredible to me that execution time can go grom 40ms to over
800ms on code alone.
I've never seen this happen in Java, but perhaps PHP is different.
Perhaps some sort of caching software would help? (i.e. APC)

gabor de mooij

unread,
Dec 2, 2009, 1:51:08 AM12/2/09
to redbe...@googlegroups.com
I recommend to use APC or eAccelerator. We use APC (It makes a lot of difference).
To speed up RedBean you can use the caching plugin, and you can tweak the journaling system (if you use it), by filtering unimportant tables. Also try some indexes; but only on tables that you need to read more than update; cause it slows down your updates.

Are you having RedBean specific performance issues or just PHP?

--

You received this message because you are subscribed to the Google Groups "redbeanphp" group.
To post to this group, send email to redbe...@googlegroups.com.
To unsubscribe from this group, send email to redbeanorm+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redbeanorm?hl=en.



dkornishev

unread,
Dec 2, 2009, 9:16:30 AM12/2/09
to redbeanphp
I am only talking about updates. $rb->store().
I don't know how caching plugin works, but I would imagine it is for
reads, not writes.
I don't use journaling system.
There are only 7 tables.

I installed APC and it knocked off about 20-40% of execution time.
Still a regular insert with Redbean takes ~700ms as opposed to
straight PDO ~40ms.
Yikes.

I measured the actual insert time (I/O) by placing metrics in the
QueryWriter, and that comes at ~40ms,
so the other ~600ms+ must come from code execution...which is
incredible. I've worked mostly in Java/JVM and I've never
seen such unfavourable execution to I/O ratio.

I guess I'll run benchmarks on a similar kind of process in a JVM.

It is very possible I am just experiencing a language-shock (seeing
that PHP isn't as great as I thought it was)
So don't take it personally

On Dec 2, 1:51 am, gabor de mooij <gabordemo...@gmail.com> wrote:
> I recommend to use APC or eAccelerator. We use APC (It makes a lot of
> difference).
> To speed up RedBean you can use the caching plugin, and you can tweak the
> journaling system (if you use it), by filtering unimportant tables. Also try
> some indexes; but only on tables that you need to read more than update;
> cause it slows down your updates.
>
> Are you having RedBean specific performance issues or just PHP?
>
> On Wed, Dec 2, 2009 at 2:32 AM, dkornishev <danil.kornis...@gmail.com>wrote:
>
> > Ok, looks like I am wrong.  Actual I/O takes ~40ms (I placed measuring
> > statements in QueryWriter).
>
> > It seems incredible to me that execution time can go grom 40ms to over
> > 800ms on code alone.
> > I've never seen this happen in Java, but perhaps PHP is different.
> > Perhaps some sort of caching software would help? (i.e. APC)
>
> > On Dec 1, 8:24 pm, dkornishev <danil.kornis...@gmail.com> wrote:
> > > Well, initially I only benched RedBean for reading...yesterday I was
> > > observing write speed...and was unpleasantly surprised.
>
> > > Today I ran a few tests doing same kind of update/insert using plain
> > > PDO and Redbean and the difference is almost 20 times!
>
> > > I have no idea what could cause it, typically I/O by far dwarfs
> > > execution times.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "redbeanphp" group.
> > To post to this group, send email to redbe...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > redbeanorm+...@googlegroups.com<redbeanorm%2Bunsu...@googlegroups.com>
> > .

gabor de mooij

unread,
Dec 2, 2009, 10:01:11 AM12/2/09
to redbe...@googlegroups.com
Did you freeze RedBean?

To unsubscribe from this group, send email to redbeanorm+...@googlegroups.com.

dkornishev

unread,
Dec 2, 2009, 11:31:52 AM12/2/09
to redbeanphp
WOW, I mean WOW.

Putting it in freeze mode dropped the time-cost to ~2ms (In a loop)

WOW

I've never seen DB-writes this fast, I am guessing both PHP and MySQL
must do some sort of caching/optimization to achieve this.

Incredible.

I think you should add a note on performance difference between fluid
and frozen modes.

On Dec 2, 10:01 am, gabor de mooij <gabordemo...@gmail.com> wrote:
> Did you freeze RedBean?
>
> > <redbeanorm%2Bunsu...@googlegroups.com<redbeanorm%252Buns...@googlegroups.com>

gabor

unread,
Dec 2, 2009, 2:47:14 PM12/2/09
to redbeanphp
Fluid mode is meant for development only (unless cpu cycles dont
count, some people have the luxury to run RB in fluid mode anyway, but
that is just another story.. )

it has been written here: http://redbeanphp.com/#/using-redbean
At first it was on the first page of the manual but I guessed people
rather like head-first examples of crud so I moved this note somewhat
to the back of the manual.
Maybe I have to put a note on the features page...

Nice to hear this works for you; Using the new Finder::where() method
you can gain even more cycles. However be careful with the caching
plugin, it is meant to save database query but it will hurt webserver
performance, only use this if your database is the bottleneck.

dkornishev

unread,
Dec 2, 2009, 3:16:05 PM12/2/09
to redbeanphp
>>Using the new Finder::where() method
>>you can gain even more cycles. However be careful with the caching
>>plugin, it is meant to save database query but it will hurt webserver
>>performance, only use this if your database is the bottleneck.

There is a finder now? :)

Anyway, reads weren't the problem, only writes. Setting to frozen
mode made writes blazing fast.

gabor de mooij

unread,
Dec 2, 2009, 4:40:45 PM12/2/09
to redbe...@googlegroups.com
Yes, it's a very simple convenience method but it also gives you an extra performance boost (because it uses a bean-conversion).

Here are the details:
http://redbeanphp.com/#/finding-beans


To unsubscribe from this group, send email to redbeanorm+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages