High CPU Problems on a MonoRail application

1 view
Skip to first unread message

Gildas

unread,
Feb 20, 2009, 12:19:43 PM2/20/09
to Castle Project Users
Hi,

We have a rather complex monorail/activerecord/rhino application. We
noticed a very high CPU consumption under heavy load so I tried to
make some tests on our development server with wcat.

When only one user is accessing the application, the CPU stay between
3 or 5%. As soon as another one is accessing the application at the
same time, the CPU exceed 90%. We use a lot of viewcomponents which
cache their output, so that's should not be the rendering process.

I suspect a lock or something similar is happening. I tried to find
out what using dottrace but every single method take a long time to
execute when 2 users are accessing the application.

Does anybody have any ideas about what to look for ?

Thanks !

--
Gildas

Andre Loker

unread,
Feb 20, 2009, 12:41:44 PM2/20/09
to castle-pro...@googlegroups.com
Hi,
Just a wild guess, maybe there are concurrent database locks that block
the requests. Have you checked the isolation levels of DB transactions
and the Windows performance logs (there are some performance counters
regarding sql server locks).

Regards,
Andre

Ayende Rahien

unread,
Feb 20, 2009, 12:46:45 PM2/20/09
to castle-pro...@googlegroups.com
what version?

Gildas

unread,
Feb 20, 2009, 1:07:33 PM2/20/09
to Castle Project Users
Hi Andre, thanks for answering. I did answer minutes ago but it looks
like google did not care...

We use NH 2nd level cache a lot and the sql server process rarely move
but I must admit I did not check those counters. I'll try that
tomorrow.

Thanks

--
Gildas

Gildas

unread,
Feb 20, 2009, 1:09:07 PM2/20/09
to Castle Project Users
Hi Ayende, thanks for answering too. We use the trunk version for
every projects.

PS: I cried this morning when I saw NHQG was gone... Not ready yet to
switch to linq2NH ;-)

Thanks

--
Gildas

On Feb 20, 6:46 pm, Ayende Rahien <aye...@ayende.com> wrote:
> what version?
>

Ayende Rahien

unread,
Feb 20, 2009, 1:11:49 PM2/20/09
to castle-pro...@googlegroups.com
Can you repro this on dev machine?

Gildas

unread,
Feb 20, 2009, 1:22:03 PM2/20/09
to Castle Project Users
Yes

On Feb 20, 7:11 pm, Ayende Rahien <aye...@ayende.com> wrote:
> Can you repro this on dev machine?
>

Ayende Rahien

unread,
Feb 20, 2009, 1:23:45 PM2/20/09
to castle-pro...@googlegroups.com
use DotTrace to pin point the problem, please.

Ayende Rahien

unread,
Feb 20, 2009, 1:24:12 PM2/20/09
to castle-pro...@googlegroups.com
NHQG hasn't changed in 6 months or more. You can safely use whatever version you are currently using.

Gildas

unread,
Feb 20, 2009, 1:25:34 PM2/20/09
to Castle Project Users
I'll try again tomorrow. Thanks for your time.

On Feb 20, 7:23 pm, Ayende Rahien <aye...@ayende.com> wrote:
> use DotTrace to pin point the problem, please.
>

Gildas

unread,
Feb 20, 2009, 1:28:32 PM2/20/09
to Castle Project Users
For information, the website is the one accessible through those
urls :

http://octogames.fr (french)
http://jogar-jogos.net (pt)

And 100 others domains, in a bit more than 20 languages.

On Feb 20, 7:23 pm, Ayende Rahien <aye...@ayende.com> wrote:
> use DotTrace to pin point the problem, please.
>

Gildas

unread,
Feb 20, 2009, 1:29:09 PM2/20/09
to Castle Project Users
I know, it does not looks complex on the public side. But the
administration is.

Gildas

unread,
Feb 21, 2009, 1:24:17 PM2/21/09
to Castle Project Users
So, from what I saw with dottrace, a lot of time was spent in the
dictionary adapter factory, which I use heavily. In fact, the
Assembly.GetName() method is slow.

The problem is that I use for Session, Context, view components and
controllers property bag and flash, even for helpers access from a
view component code. AspView use it too.

So, I made my own implementation of the dictionary adapter factory
which keeps a Dictionary<Assembly, string> with the assemblies and
their names. I saw an improvement already with this. Then, I found out
that AspViewBase instanciate a new DictionaryAdapterFactory in its
constructor instead of resolving this service through the engine
context. I changed that too. I hope Ken will read this. There's
probably a good reason for that but the performances were better too
after this change.

Andre, I've checked the lock counters for SQL : nothing special. There
was a lot of locks request, but no wait time and no dead locks.

I'll let the website run some days and will let you know how it goes.

Thanks for your help.

--
Gildas

Ken Egozi

unread,
Feb 21, 2009, 4:44:13 PM2/21/09
to castle-pro...@googlegroups.com
There is a probable reason - sloppy coding on my part.

I'd appreciate a patch.

and another one for the assemblies dictionary in the DictAdapterFactory.

Gildas

unread,
Feb 21, 2009, 5:03:47 PM2/21/09
to Castle Project Users
:) Well, I'll send you both monday then.

I'm glad if this can be helpful.

--
Gildas

Gildas

unread,
Feb 23, 2009, 6:49:03 AM2/23/09
to Castle Project Users
A little question about the AspViewBase patch :

To get the IDictionaryAdapterFactory from the IEngineContext, this
service must be registered in the underlying IoC container. As far as
I know, this component is external, and nothing forces someone to
register it.

The question is : should it be added to the IMonoRailServices
interface ?
> > Ken Egozi.http://www.kenegozi.com/bloghttp://www.delver.comhttp://www.musicglue...

Ken Egozi

unread,
Feb 23, 2009, 7:11:38 AM2/23/09
to castle-pro...@googlegroups.com
this would render the dict adapter assembly a prerequisite for monorail (like Binder etc.)

not that I have any kind of a problem with that.  I find the dict adpater extremely useful when dealing with Session, Cache and AppSettings, on top of PropertyBag and Flash.  all relevant to all view engines.

Gildas

unread,
Feb 23, 2009, 8:01:49 AM2/23/09
to Castle Project Users
So, should I include this modification in the patch ?

Ken Egozi

unread,
Feb 23, 2009, 8:20:01 AM2/23/09
to castle-pro...@googlegroups.com
yes please.

Gildas

unread,
Feb 27, 2009, 5:44:47 AM2/27/09
to Castle Project Users
I finally got enough time to make those patches.

All tests succeeded.

Ken Egozi

unread,
Feb 27, 2009, 6:15:03 AM2/27/09
to castle-pro...@googlegroups.com
I saw this.  thx.  hopefully I'll get to review and apply this weekend
Reply all
Reply to author
Forward
0 new messages