You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug This is happening in eox-tagging 5.0.0. In the last two weeks, we noticed a service degradation in one of our installations due to expensive queries. Such queries are related to fetching the Tag model objects. We discovered that those queries stress the MySQL server too much, resulting in very slow response times. Below, you'll find a graph displaying the response time for the TAG select queries during a period of service degradation:
With a low throughput (10-15 queries per minute), the response is pretty slow. Additionally, given that the database is stressed, other endpoints responses are also affected.
What is triggering these queries?? The most important source we've identified is the rendering of the certificates using the Tag model on their templates. Those templates include Python lines (thanks to Mako) like:
from eox_tagging.models import Tag
def get_tags(username, course_id):
tags = {}
certificate_tags = Tag.objects.find_all_tags_for("generatedcertificate", {"username": username, "course_id": course_id})
for tag in certificate_tags:
tags[tag.tag_type]= tag.tag_value
return tags
tags = get_tags(username, course_id)
By running a simple query, we can find the certificate templates invoking the tagging model:
select id, name, is_active from certificates_certificatetemplate where template like "%eox_tagging.models%";
To Reproduce
Steps to reproduce the behavior:
Find a certificate ID rendered from a template using the TAG model (we can help with that)
Access the URL https://< lms-site >/certificates/< certificate-id >
This will trigger the slow query. The LMS takes about 7-8 seconds to respond
There's no error displayed, however, when having concurrent requests pointing to the same problematic certificate generation, a service degradation occurs.
Expected behavior
Querying the Tag model shouldn't generate service degradation. Rendering certificates querying the Tag model shouldn't take too long (a normal response should be between 2-3 seconds according to other certificate rendering tests)
Screenshots
XXX
Additional context
This is probably related to indexes lacking. Right now the table contains about 5,4 million records. An example of a slow query is displayed below:
SELECT `eox_tagging_tag`.`id`, `eox_tagging_tag`.`key`, `eox_tagging_tag`.`tag_value`, `eox_tagging_tag`.`tag_type`, `eox_tagging_tag`.`access`, `eox_tagging_tag`.`activation_date`, `eox_tagging_tag`.`expiration_date`, `eox_tagging_tag`.`created_at`, `eox_tagging_tag`.`status`, `eox_tagging_tag`.`inactivated_at`, `eox_tagging_tag`.`target_type_id`, `eox_tagging_tag`.`target_object_id`, `eox_tagging_tag`.`owner_type_id`, `eox_tagging_tag`.`owner_object_id` FROM `eox_tagging_tag` WHERE (`eox_tagging_tag`.`target_object_id` IN (<any_object_id>) AND `eox_tagging_tag`.`target_type_id` = <any_target_type_id>)
The text was updated successfully, but these errors were encountered:
Describe the bug
This is happening in eox-tagging 5.0.0. In the last two weeks, we noticed a service degradation in one of our installations due to expensive queries. Such queries are related to fetching the Tag model objects. We discovered that those queries stress the MySQL server too much, resulting in very slow response times. Below, you'll find a graph displaying the response time for the TAG select queries during a period of service degradation:
With a low throughput (10-15 queries per minute), the response is pretty slow. Additionally, given that the database is stressed, other endpoints responses are also affected.
What is triggering these queries?? The most important source we've identified is the rendering of the certificates using the Tag model on their templates. Those templates include Python lines (thanks to Mako) like:
By running a simple query, we can find the certificate templates invoking the tagging model:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Querying the Tag model shouldn't generate service degradation. Rendering certificates querying the Tag model shouldn't take too long (a normal response should be between 2-3 seconds according to other certificate rendering tests)
Screenshots
XXX
Additional context
This is probably related to indexes lacking. Right now the table contains about 5,4 million records. An example of a slow query is displayed below:
The text was updated successfully, but these errors were encountered: