Yes, the action filters are another type of component that will help reduce the per-request allocation footprint. The tricky part, as you would imagine, are the places where the long-lived components reference per-request data or services (like the current user, content manager, or database session).
From: Renaud Paquay [mailto:[email protected]] Sent: Friday, January 28, 2011 3:21 PM To: [email protected] Subject: RE: Question regarding ContentHandlers The reason you are seeing ContentHandlers being used every minute or so even if there is no browser request is because there are a couple of background tasks running every minute (Update index and maintain list of active slugs, for example) As for performance, we haven't noticed ContentHandlers being a significant bottleneck when we did the performance work for v1. As a "best practice" in Orchard, we always try to make sure that constructors of components implementing "IDependency" (contentHandlers fall into that category) don't do any significant work. Mostly, constructors receive dependencies and just assign them to fields, any other significant work should be done "lazily" when needed (that's why we have a LazyField class for example). However, even though we haven't measured significant impact yet, you are correct that this might become a concern when there are a lot of handlers. We had planned to make Handlers singleton for V1, but we ended up not having enough time to address this "potential" problem: we mainly addressed the performance issues we could measure to have a significant impact. All in all, it may be the case that in a future version of Orchard, ContentHandlers become singletons... HTH, Renaud From: Chance Dinkins [mailto:[email protected]] Sent: Friday, January 28, 2011 10:10 AM To: [email protected] Subject: Question regarding ContentHandlers Hey, I was poking around and noticed some strange behavior with ContentHandlers and I'm wondering if this intended or even correct. It seems that every ContentHandler is initialized on per request and I've also seen a sort of polling effect where even without a browser requesting the page, each ContentHandler is being initialized at about once a minute. If this intended behavior, it seems like it may generate some pretty significant performance hit on a site that has a number of handlers and large traffic volume. Or am I missing something? If I'm not, could they follow a singleton pattern? Thanks, Chance --- You are currently subscribed to orchard-discuss as: [email protected]<mailto:[email protected]>. To unsubscribe send a blank email to [email protected]<mailto:[email protected]>. --- You are currently subscribed to orchard-discuss as: [email protected]. To unsubscribe send a blank email to [email protected]. --- You are currently subscribed to orchard-discuss as: [email protected]. To unsubscribe send a blank email to [email protected].
