[ckan-dev] slow tags page

Sean Hammond sean.hammond at okfn.org
Mon May 7 09:33:37 UTC 2012


> The CKAN tags page loads pretty slowly. In our site we have 8000 tags
> and on my own machine one page load takes 75 seconds.
> 
> It only recently became this slow, and it seems to be the dictization
> of each tag, because all_fields=True in the controller. This is only
> necessary when tags have vocabularies or translations. We don't have
> those on our site, so I've overridden the controller to make made
> all_fields=False. This got my page load down to 2s.

Without profiling it I think the problem might be that (if passed
all_fields: True) the tag_list() logic action function is calling
tag_dictize() for each tag. Looking at tag_dictize(), it calls
obj_list_dictize() on each tag's packages as well.

There is a tag_list_dictize() function that doesn't dictize the packages
of the tags, maybe tag_list() should be using this instead.

Background:

This is due to the recently added support for multilingual datasets (and
tags and groups). A display_name field is added to tags during
dictization, they need to have both name and display_name because name
will be used in URLs whereas display_name is displayed to users and may
get translated by the multilingual_tag plugin.

In order for this to work, the tag controller needs to work with a list
of tag dicts not just a list of tag name strings as it did before. So it
now necessarily dictizes all the tags.

See: 73a2b884d423ba584e8c9a985ff6d3380f0690ba




More information about the ckan-dev mailing list