-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/manage_catalogView
takes ages to open in large sites
#155
Comments
I am almost sure that this is not the primary problem problem cause. |
I suggest you use profiling to find out in more detail which operations are responsible for the huge time (one possibility would be to use Thus, in principle, the current |
I have also noticed this problem. I agree with @d-maurer that in principle the operation should be lazy and therefore fast, so it would be good if someone can investigate why that is not the case. However I also agree that it would make sense to not do any query when the view is first loaded without any parameters. It's unlikely the user is looking for an item that appears in the first batch, so showing results at this point doesn't add much value. |
David Glick wrote at 2024-9-26 08:21 -0700:
I have also noticed this problem. I agree with @d-maurer that in principle the operation should be lazy and therefore fast, so it would be good if someone can investigate why that is not the case.
I have used `dm.zope.profile` to profile `manage_catalogView`
(Plone 5.2, Python 3.10, Products.ZCatalog 5.4):
Catalog size Time Lazy.getitem (#/Time)
40 0.131 n/a
1776 0.246 5331/0.118
2641 0.344 7926/0.223
We can conclude from this that the batching does not work:
`manage_catalogView` uses `dtml-in` for its batching;
it uses 3 `dtml-in`: to access the content, for `previous` and `next`.
Apparently, each of them calls `Lazy.getitem` for each element
in the list.
|
you're absolutely right: the problem is not there. Further investigetion shown me that the lazymap is interated at least 4 times in the process of populating dtml-in batch. So, with this commit @hannosch choose to unpack it one time only as soon as possible and let iterating over the The batch does not work as expected and it should be fixed, but as @davisagli pointed out:
So, is the workaround I proposed still valuable? I'm preparing a PR even for 5.x branch. It's almost harmless. |
…unnecessary loading time (proxy error) #155
@d-maurer, @sauzher thank you very for your interesting findings. Actually we saw this slow-down, too.
IMHO the initial page has a high value because you get a quick overwiew of the quality of the indexed data. So, it would be great to avoid the the formly introduced list conversion and maintain this first glance to the data. |
***@***.*** wrote at 2024-9-27 08:24 +0200:
...
I have used `dm.zope.profile` to profile `manage_catalogView`
(Plone 5.2, Python 3.10, Products.ZCatalog 5.4):
Catalog size Time Lazy.getitem (#/Time)
...
2641 0.344 7926/0.223
We have redone the profiling with
zopefoundation/DocumentTemplate#76
Catalog size Time Lazy.getitem (#/Time)
2641 0.102 n/a
Almost surely, the PR above fixes the problem.
|
I suggest the following change:
|
@d-maurer I guess you are proposing to only make this change for when filterpath is empty? The suggestion makes sense to me, but I don't particularly like the name
and then use self.get_uids().items(min, max) |
David Glick wrote at 2024-10-1 20:56 -0700:
@d-maurer I guess you are proposing to only make this change for when filterpath is empty?
No. I propose this change to be used always and
implement the "filterpath" functionality
with the `min` parameter of `catalogued_objects`.
Likely `"catalogued_objects(min=REQUEST.get('filterpath', '')"`
can be used.
Remember: the time you have observed with the `DocumentTemplate` PR
will not change significantly when you use a filter (unless this
filter is very specific).
The suggestion makes sense to me, but I don't particularly like the name `catalogued_objects` since it only returns record ids and not any full result object. My suggestion would be:
```
def get_uids(self):
return self._catalog.uids
```
I do not feel strongly about the name `catalogued_objects`
and I do not plan to implement my suggestion; if someone implements
it, he/she can fill in the details.
I do not think we should expose the mutable `uids` however,
but an immutable `uids.items(min, max)`.
And I believe we should not have separate implementations
for the "filtered" and "not filtered" cases but
implement the "filtered" case with the `min` parameter
(and otherwise use the same view logic).
|
@d-maurer Okay, that all makes sense |
BUG/PROBLEM REPORT and Proposal of Improvement/Solution
What I did:
Populate a Plone (portal_catalog) with tens of thousands objects (15.000 is enough to experiment the issue)
What I expect to happen:
In the Zcatalog 2.13 the
manage_catalogView
opens almost immediately regardless of cardinality of the catalog.I expect the same behavior today.
What actually happened:
The dtml page takes too much time to load. In a production enviroment it could easly lead to a proxy error.
What version of Python and Zope/Addons I am using:
Zope => 4, Plone >= 5.2
Some Insight
The line of code that takes 99% of the time to be executed is:
https://github.com/zopefoundation/DocumentTemplate/blob/9496ce63234a849961ef7bcd85890632bb14bf3d/src/DocumentTemplate/DT_Let.py#L85
in 2.13 the document tempate procedure to expand records (
render_blocks
method) was written in C, hereFrom 3.x onwards, the
render_blocks
method is written in pure pythonProposal of Improvement
Simply do not render the results Table if no path is specified.
In that way, the manager has still the opportunity
alessandro (from the Salamina PloneSprint 2024)
The text was updated successfully, but these errors were encountered: