Hi there.
I'll ask my question upfront, then I'll explain what we're seeing. Would love your input.
Question:
Do you think it's more efficient to render large list views that might be run by many users at the same time using a LIST method off the database view or a LIST method from a SQL stored procedure?
We were always told by various consultants that the best practice on list views is to put the burdon on the SQL database via stored procedure (SPROC) as opposed to using just K2 "list" method on a database table or view.
We built out a new solution that does this...it's a solution that's used by a lot of people (probably 220+ at any one time in additionl to the 4*personal details removed* other users that are using K2 for other solutions) and the list view fires a lot based on the way the solution is designed. The typical number of records returned on the list would average between 500 and 1500 records (although the list view only shows 20 at a time) with a maximum of maybe 6500 records in extreme cases.
Lately, we've gotten a lot of complaints from the business that the lists are rendering very slowly.
So, going out to the database and running the stored procedure with selected parameters to return about 1200 records, the number of seconds to run the query would typically be about 1-2 seconds. Often less than a second.
Running the same parameters for the related smart object at about the same time (same traffic) with the smart object service tester (at the height of utilization) it would take anywhere from 37 to 65 seconds to return the same 1200 records. Huge difference.
Obviously, running in the form, it would take the same amount of time or longer.
During those very busy times when it was returning results slowly, I reached out to the DBA and he confirmed that the same list stored procedure running over and over again by the number of K2 users in that form at that time did put some strain on the database and took up a goodly percentage of CPU/RAM.
So...as an experiment, we switched from the stored procedure to generate the list view to simply creating a new "LIST" method on the smart object that generates the list directly from the database view.
It is MUCH MUCH MUCH faster...consistently. What would take 37 seconds to render in the Smart Object Service Tester using the SPROC woudl take like 1.5 seconds just doing a List method directly from the DB view.
We re-built the form to use the list method last night, and it's run perfectly (much faster) all day today.
SO....back to my question.
Do you think it's more efficient to render large list views that might be run by many users at the same time using a LIST method off the database view or a LIST method from a stored procedure?
It was hinted to me by a K2 tech support type that with the new version, they put better caching and traffic control in place for K2 to handle some of that stuff. I can't help but think that might be true from what I'm seeing.
What do you think?
I hope I explained this in an undestandable way.
Best,
Rob