I have an application where the preprocess interception point is taking around 800ms or more to run. Is this normal? I have an API that I’m hitting via Ajax for an autosuggest and because of that time it is a bit too slow to pop up suggestions and doesn’t feel responsive enough.
If this is NOT normal, what should I check to speed things up a bit? I’ve checked every setting I can think of and I’m out of ideas. I’m even caching my API results and while it makes things faster, it still isn’t quite fast enough.
If this IS normal, what options do I have?
I’m using CB 3.1 and CF9 + ORM.
What interceptors do you have enabled? For your custom interceptors you may want to crack them open, and use the TimerPluigin to isolate the bottleneck.
Right now I have the Autowire, SES, and Security interceptors enabled.
As far as the TimerPlugin, the Coldbox site is down at the moment so I can’t look it up. How do I use it?
If you don’t have custom interceptors I would not worry about the timer plugin… its pretty simple to use and quite helpful in performance tuning. But, without custom code, the issue is elsewhere.
Do you have any of these settings set to true?
Ok, I figured it out. I forgot about the security interceptor and the validator object. It pulls the user info and permissions out of the database on every request and it was causing the slow down. Thanks for helping me locate the problem.
Now that I know why it is slow, how should I go about caching the user object (which I pull out of the ORM)? If I remember correctly, can’t problems arise from caching entities in the Session scope? Is the ORM secondary cache a good solution for this?
ORM Secondary cache is a great solution for almost all applications.
What type of application are you building? There are other ways to store this that could be better depending on what your building. Could be as simple as a cookie. All depends.