Closed (fixed)
Project:
CAS
Version:
7.x-1.x-dev
Component:
CAS
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 Jun 2014 at 14:53 UTC
Updated:
11 Jul 2014 at 18:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mpruitt commentedPatch for 7.x-1.x.
Comment #2
yalet commentedI wonder if we can get some data on the speed improvement offered by this patch. Also, which queries were causing the problem? It could be there are code architecture improvements that could be made to solve the problem, in addition to (or instead of) just slapping an index on it.
Comment #3
mpruitt commentedyalet, I'll forward the request to my engineer.
Regards,
Mark
Comment #4
mpruitt commentedTim, here is the slow query report: (apologies for ugly line breaks). I have asked for information regarding performance improvement.
If you have additional questions I'll be happy to get the answers.
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 3 8863
# Exec time 53 290s 13ms 363ms 33ms 87ms 21ms 23ms
# Lock time 1 382ms 19us 50ms 43us 44us 511us 33us
# Rows sent 0 7.81k 0 1 0.90 0.99 0.29 0.99
# Rows examine 91 671.60M 56.46k 213.48k 77.59k 211.82k 51.20k 56.74k
# Query size 0 442.81k 48 53 51.16 51.63 2.01 51.63
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms ################################################################
# 100ms #
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `****` LIKE 'cas_user'\G
# SHOW CREATE TABLE `****`.`cas_user`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT aid, cas_name FROM cas_user WHERE uid = ######\G
# *************************** 1. row ***************************
# id: 1
# select_type: SIMPLE
# table: cas_user
# partitions: NULL
# type: ALL
# possible_keys: NULL
# key: NULL
# key_len: NULL
# ref: NULL
# rows: 59767
# Extra: Using where
Comment #5
mpruitt commentedHere is the patch back ported for 6.x-3.x.
Comment #7
mpruitt commented5: cas-uid_index-2289871-D6-5.patch queued for re-testing.
Comment #9
emsearcy commentedCurrently with our hardware and table size, it is taking an average of 33 ms for the query (it's hitting our slow query due to log-queries-not-using-indexes). This may not sound like a lot but that's an extra .03 seconds on any page load that loads a user object (and of course for pages that load many users, like a blog listing, that's several 30ms hits which adds up fast). As our user base grows, this will get slower, and I'm sure there are organizations like universities that may want to implement logins with far larger user databases than I.
Mark's output above was from pt-query-report, here is the top part with better columns from a different day. You can ignore the pct column, as that is percentage of across all queries in our report that day. Exec time row's min, max, avg, and 95th percentile are the key items there.
Comment #10
emsearcy commentedOh, and the performance improvement is from the old 13-125ms to a new 0.00 sec.
Comment #11
mpruitt commentedRenamed patch following the guidelines for "Patches for Different Versions" at https://www.drupal.org/node/332678#versions.
Comment #12
metzlerd commentedI think that this is a reasonable request, however, I noticed that in the patch, you call the index cas_user in one place and UID in another. Also, to improve upgradability it would be best to add a test to see if the index exists prior to adding it in the update hook. Would you mind resubmitting this patch with those mods?
Thanks
Dave
Comment #13
mpruitt commentedDave, no problem, I'll be glad to look into that this week.
Mark
Comment #14
mpruitt commentedChanges requested by Dave. I apologize for the duplicate file.
Comment #15
mpruitt commentedComment #16
mpruitt commentedComment #17
yalet commentedComment #18
metzlerd commentedLooks good to me... I will work on committing these today.
Comment #21
metzlerd commentedCommitted and pushed to 7.x-1.x and 6.x-3.x branches. I made a small alteration to the latest 6.x patch so that it was using the same index name as the 7.x patch.