You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2012-08-31 19:34:17

domarques
Member
Registered: 2012-01-31
Posts: 4

Autocomplete / dynamic dropdowns slow with large user db (0.83)

Hi all!

I have a large amount of users (40k+) sync'd with our ldap server (using scripts/ldap_mass_sync.php) and when i try to create a new ticket, the autocomplete starts to search for users at any character typed (seems that is ignoring the config bellow - if i'm doing it right).

I'm using the following configs:

Use dynamic display for dropdowns and text fields : yes
Use dynamic display for dropdowns and text fields : 50
Autocompletion of text fields : yes
Minimum size of the text for dynamic search in dropdowns : 5
Maximum number of items to display in the dropdowns when wildcard is not used : 20
Character to force the full display of dropdowns (wildcard) : * (default)

Note: I'm using GLPI v0.83.1

Last edited by domarques (2012-08-31 20:45:15)

Offline

#2 2012-09-07 09:11:14

tomolimo
Member
From: Grenoble, France
Registered: 2009-05-12
Posts: 515

Re: Autocomplete / dynamic dropdowns slow with large user db (0.83)

I had the same problem (with 0.80 version), which I solved the following way: and I made a change in the search textbox, so that it will wait 900ms before starting the search. This limits the quantity of requests and by the way improve user experience and responsetime.
This modification is in the ajax.function.php file, I've added to the ajaxUpdateItemOnEventJsCode a delay that buffers keyup events and send only one per 900ms (see below):

function ajaxUpdateItemOnEventJsCode($toobserve, $toupdate, $url, $parameters=array(),
                                     $events=array("change"), $spinner=true,$prefixEltsearch="") {

   if (is_array($toobserve)) {
      $zones = $toobserve;
   } else {
      $zones = array($toobserve);
   }

   foreach ($zones as $zone) {
      foreach ($events as $event) {
         echo "
            Ext.get('$zone').on(
               '$event',
               function() {";
                     ajaxUpdateItemJsCode($toupdate, $url, $parameters, $spinner, $toobserve);
// TOM 09-Nov-2011 added ", this, { buffer : 900 }" to prevent too much keyup events                      
         echo "}, this, { buffer : 900 });\n";
      }
   }
}

This modification is based on the ExtJS documentation (see buffer explanations): http://docs.sencha.com/ext-js/3-4/#!/ap … ddListener


regards,
Tomolimo

Last edited by tomolimo (2012-09-07 09:15:10)


GLPI 9.2.4 - PHP 7.2.13 x64 / ProcessMaker 3.3.0-community-RE-1.7 - PHP 7.1.24 x64 / Windows 2012 x64 / IIS 8.5 / MySQL 5.7.17 x64
Worldwide: >12316 PC, >9400 users (16 languages, >11 timezones), >360k tickets, >3600 entities, >4200 groups
Raynet is ARaymond (http://www.araymond.com) IT service management

Offline

#3 2012-09-07 09:26:23

remi
GLPI-DEV
From: Champagne
Registered: 2007-04-28
Posts: 7,127
Website

Re: Autocomplete / dynamic dropdowns slow with large user db (0.83)

In 0.83, you have an option to wait for a minimum number of char before launching ajax request


Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/

Offline

#4 2012-09-07 11:07:11

tomolimo
Member
From: Grenoble, France
Registered: 2009-05-12
Posts: 515

Re: Autocomplete / dynamic dropdowns slow with large user db (0.83)

I think that both mechanisms can be usefull, a threshold and a buffering time
regards,
Tomolimo


GLPI 9.2.4 - PHP 7.2.13 x64 / ProcessMaker 3.3.0-community-RE-1.7 - PHP 7.1.24 x64 / Windows 2012 x64 / IIS 8.5 / MySQL 5.7.17 x64
Worldwide: >12316 PC, >9400 users (16 languages, >11 timezones), >360k tickets, >3600 entities, >4200 groups
Raynet is ARaymond (http://www.araymond.com) IT service management

Offline

#5 2012-09-13 17:17:25

domarques
Member
Registered: 2012-01-31
Posts: 4

Re: Autocomplete / dynamic dropdowns slow with large user db (0.83)

Hi guys, sorry for delay, i was sick this days sad

I'm trying to solve this using something similar like Tomolimo told (many thanks for posting your code, btw). Someone told me to use Ext.util.DelayedTask to avoid this problem.

@remi: i had configured that option, but that's not the real problem, let me try explain the problem one more time:

That option is defined to 5 characters (see bellow the js). When try to search for a user on the ticket form, at each keypress the search is restarted. So if an name has 10 or more letters this is getting too much time. Additionally any mistype can be irritating, because the search continues to be restarted.   

The html generated page, only as example, to show the option to restrict the length of characters.
(...)
Ext.get('search_414668662').on('dblclick',
                function() {if ( Ext.get('search_414668662').getValue().length >= 5  || Ext.get('search_414668662').getValue() == '*') {Ext.get('results_414668662').load({
          url: '/servicedesk/ajax/dropdownUsers.php',
          scripts: true,
(...)

Thanks.

Last edited by domarques (2012-09-13 17:19:55)

Offline

#6 2012-09-25 16:05:31

MoYo
GLPI - Lead
From: Poitiers
Registered: 2004-09-13
Posts: 14,513
Website

Re: Autocomplete / dynamic dropdowns slow with large user db (0.83)


MoYo - Julien Dombre - Association INDEPNET
Contribute to GLPI :    Support     Contribute     References     Freshmeat

Offline

#7 2012-09-25 16:36:20

MoYo
GLPI - Lead
From: Poitiers
Registered: 2004-09-13
Posts: 14,513
Website

Re: Autocomplete / dynamic dropdowns slow with large user db (0.83)

thanks for your interesting proposal


MoYo - Julien Dombre - Association INDEPNET
Contribute to GLPI :    Support     Contribute     References     Freshmeat

Offline

Board footer

Powered by FluxBB