Hey guys,
I'm using ACL to control my application.
I use it in the flavour of ACL "controlled"
My user model $actsAs = array('Acl' => array('requester'));
When I was building the application with 10 users and 5 groups
everything was working fine.
Every user belongsTo a group.
I then inserted 11,000 records in my user table... and all actions
that require ACL check in the ARO/ACO table are really slow!
Here an example of the queries that slow down the application:
takes 5502 ms
-------------------------------
SELECT `Aro`.`id`, `Aro`.`parent_id`, `Aro`.`model`,
`Aro`.`foreign_key`, `Aro`.`alias` FROM `aros` AS `Aro` LEFT JOIN
`aros` AS `Aro0` ON (`Aro`.`lft` <= `Aro0`.`lft` AND `Aro`.`rght` >=
`Aro0`.`rght`) WHERE `Aro0`.`model` = 'User' AND `Aro0`.`foreign_key`
= 1 ORDER BY `Aro`.`lft` DESC
-------------------------------
takes 628 ms
-------------------------------
SELECT `Aco`.`id`, `Aco`.`parent_id`, `Aco`.`model`,
`Aco`.`foreign_key`, `Aco`.`alias` FROM `acos` AS `Aco` LEFT JOIN
`acos` AS `Aco0` ON (`Aco0`.`alias` = 'controllers') LEFT JOIN `acos`
AS `Aco1` ON (`Aco1`.`lft` > `Aco0`.`lft` AND `Aco1`.`rght` <
`Aco0`.`rght` AND `Aco1`.`alias` = 'Crags') LEFT JOIN `acos` AS `Aco2`
ON (`Aco2`.`lft` > `Aco1`.`lft` AND `Aco2`.`rght` < `Aco1`.`rght` AND
`Aco2`.`alias` = 'admin_index') WHERE ((`Aco`.`lft` <= `Aco0`.`lft`
AND `Aco`.`rght` >= `Aco0`.`rght`) OR (`Aco`.`lft` <= `Aco2`.`lft` AND
`Aco`.`rght` >= `Aco2`.`rght`)) ORDER BY `Aco`.`lft` DESC
-------------------------------
This is a demo structure of my aro table (with just 7 records out of
11,000):
id| parent_id | model | foreign_key | alias | lft |
rgt |
---------------------------------------------------------------------------------
1 | NULL; | Group | 1 | superadmin | 1 |
4 |
2 | NULL; | Group | 2 | admin | 5
| 6 |
3 | NULL; | Group | 3 | news_editor | 7 |
8 |
4 | NULL; | Group | 4 | utenti | 9 |
20200 |
5 | NULL; | Group | 5 | guests | 20201 |
20202 |
6 | 1 | User | 1 | |
2 | 3 |
7 | 4 | User | 2 | |
10 | 11 |
Did anybody found the same problem?
Any clue on how to speed up things?
Cheers
dan
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en