Friday, January 06, 2006

More OSCache

I've spent a few days now (off and on), working with OSCache -- to try and cache objects at the DAO level. Before you start in on me, please be aware that the code I'm working on is pre-Hibernate. The DAO's don't have access to the wonderful EHCache provided via Hibernate. I realize I could move the product over to Hibernate, but that would take a lot longer than two days, most likely.

I just completed the first phase of the project, moving the three objects that do most of the heavy lifting, to use OSCache. The numbers are quite amazing:

No cache:
First run: 211,710 ~ 21 sec
Second run: 198,336 ~ 20 sec
Third run: 204,442 ~ 20 sec
Fourth run: 200,189 ~ 20 sec
Fifth run: 195,941 ~ 20 sec
Sixth run: 196,608 ~ 20 sec
Seventh run: 137,639 ~ 14 sec
Eight run: 122,488 ~ 12 sec
Ninth run: 142,241 ~ 14 sec
Tenth run: 209,192 ~ 20 sec

Average: 181,878 ~ 18 sec
Max: 211,710 ~ 21 sec
Min: 122,488 ~ 12 sec

Cache:
First run: 218115 ~ 22 sec
Second run: 21 < 1 sec
Third run: 23 < 1 sec
Fourth run: 37 < 1 sec
Fifth run: 12 < 1 sec
Sixth run: 8 < 1 sec
Seventh run: 62 < 1 sec
Eight run: 16 < 1 sec
Ninth run: 6 < 1 sec
Tenth run: 5 < 1 sec

Average: 21,830 ~ 2 sec
Max: 218,115 ~ 22 sec
Min: 5 < 1 sec

That's quite a change. Considering that we do (normally) hit the database between 80,000 and 100,000 times per day, my hope is to drop that number down to under 5,000 using OSCache. So far, it's very promising.

0 Comments:

Post a Comment

<< Home