- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 06-18-2021 03:16 PM
< Previous Article | Next Article > | |
Performance Hacks: Reference Fields (1 of 4) Reference Popup / Reference Lookup | Performance Hacks: Reference Fields (3 of 4) The Autocomplete Query |
ServiceNow Reference Field
What a wonderful tool! What a multi-faceted, powerful, customizable, many-splendored thing!! But it can be SOOOOO slow!
I'll be posting a new article every Friday. Here is article #2 of 4:
The Problem
Reference Autocomplete works by waiting a defined amount of time between keypresses and then sending an AJAX request to the server with the characters that have been written so far.
Here's an example of an Autocomplete request sent for the letter "a" from the standard ServiceNow UI - UI16 (aka Concourse).
/xmlhttp.do
The issue comes in when these requests are frequent enough and/or slow enough to start causing performance issues. You may have experienced that while the browser is waiting for your autocomplete response to come back you are basically dead in the water and can't do anything else on the form.
Also, in some areas of the platform1 these requests are "cancelable" and in other areas these requests are not. When a request is cancelable it means that if a second request comes in from the same user before the first request is finished, ServiceNow will immediately cancel the first request and start processing the second one. If a request is not cancelable, then subsequent requests can start to stack up Session Wait very quickly! That can be quite a bad thing!! See "Troubleshooting Guide: Using the Transaction Logs" - KB0584420 to read about Session Wait.
Some Solutions
In my experience a wait time of 1500 milliseconds is virtually indistinguishable from the default 250 milliseconds! Even testing as high as 3 seconds of wait time between key presses was acceptable although a noticeably laggy. In one customer situation, I recorded that going from 750 milliseconds of wait time to 1.5 seconds of wait time resulted in 10x reduction in autocomplete requests across their instance!
1. Increase global autocomplete wait time
Global autocomplete wait time can be controlled by the glide.xmlhttp.ac_wait_time property; which defaults to an incredibly fast 250 milliseconds. This often results in multiple requests to the server, one right after the other as the user types "T", "To", "Tom", "Tom W","Tom Wa","Tom Wai", ""Tom Wait","Tom Waits"... I type about 70 words per minute with 100% accuracy in typing tutors and 250 milliseconds for auto-complete is too fast for me. ServiceNow often fires autocomplete requests while I am in the middle of typing a word.
Set glide.xmlhttp.ac_wait_time to 1500 milliseconds or more.
2. Increase contextual search wait time
Contextual search isn't really a reference field, so it is a bit off topic for this article, but I thought I'd mention it because it can be a real nightmare for performance and it has virtually the same autocomplete wait between keypress behavior.
Set com.snc.contextual_search.wait_time to 1500 milliseconds or more.
P.S. If you are getting real tricky and trying to customize your ServicePortal with the snRecordPicker or a related directive, see the following article: Reference field snRecordPicker: Performance Tips for ServicePortal/Angular Directive
In my next article, I'll discuss the way that the autocomplete columns that you specify (via the ref_ac_columns attribute) can result in non-sargable predicates in your queries. More importantly I'll talk about ways to improve those queries!
< Previous Article | Next Article > | |
Performance Hacks: Reference Fields (1 of 4) Reference Popup / Reference Lookup | Performance Hacks: Reference Fields (3 of 4) The Autocomplete Query |
1 The standard Service Portal reference field and the standard UI16 reference field the requests are cancelable
- 2,666 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
A new article, Optimizing the Service Portal Typeahead search widget, has been written by ServiceNowPerformanceGTS. It covers advanced topics related to the "cancelable" behavior of contextual search in various scenarios, including changes introduced in the Paris version of ServiceNow and onwards.

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Is there a similar solution to improving the performance of reference fields autocomplete in the Workspace?