Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When searching the tree, increase the time before querying for items #5342

Closed
dkuji opened this issue Jun 1, 2023 · 23 comments
Closed

When searching the tree, increase the time before querying for items #5342

dkuji opened this issue Jun 1, 2023 · 23 comments
Labels
bug Undesired behaviour enhancement General tag for an enhancement porting required Requires porting to develop resolved A fixed issue
Milestone

Comments

@dkuji
Copy link

dkuji commented Jun 1, 2023

Hi.
We are running a very large Cacti server. (Devices: over 1,000, Graphs: over 14,000)

OS: RockyLinux8.6
Cacti: 1.2.21
CPU: 12core
Memory: 32GB

It takes a very long time to search for a graph by entering a tree name or graph name from the Graph tab screen of the WebUI. (More than 100 seconds, I have confirmed that I have enough cpu and memory at this time).

However, if the device name is copied and pasted, it takes only a few seconds to complete the search.

I checked from Chrome's developer tools, and it looks like the search process is executed while typing with the following request.

graph_view.php?action=ajax_search&str=<input string>

I believe this is the cause.

Is there any way to disable the search while typing?

@netniV
Copy link
Member

netniV commented Jun 1, 2023

Rather than disable the search when typing, there should be a preset 'delay' before initiating the search so that any further keystrokes do not fire off searches of their own. I think that would be a good enhancement.

@dkuji
Copy link
Author

dkuji commented Jun 1, 2023

Thanks for the reply.

I think that is a very good idea.
By the way, how should I set the "delay"?
I can't find that parameter in the settings page.

@TheWitness
Copy link
Member

TheWitness commented Jun 3, 2023

It does not look like jsTree has a delay function built into the core of the plugin, bummer. The author shows an example of searching but outside the default plugin.

@TheWitness
Copy link
Member

Been a long time since I've looked at this. I'm going to increase the keyup delay to 500ms.

@TheWitness
Copy link
Member

How much do you control the permissions at the Cacti level? That sounds like a slow database or a busy one.

@TheWitness
Copy link
Member

You might want to consider using the Browser Debug window and then the Network Window to see if the ajax part of the search is slow, or the javascript part is.

@TheWitness
Copy link
Member

In the example below. You can see that the search comes back in less than 100ms.

TreeSearchTiming

@TheWitness TheWitness changed the title Graph search is executed while typing and is very slow Increase keyup delay when searching the tree Jun 3, 2023
@TheWitness TheWitness added the enhancement General tag for an enhancement label Jun 3, 2023
@TheWitness TheWitness added this to the v1.2.25 milestone Jun 3, 2023
TheWitness added a commit that referenced this issue Jun 3, 2023
Increase keyup delay when searching the tree
@TheWitness TheWitness added bug Undesired behaviour resolved A fixed issue porting required Requires porting to develop labels Jun 3, 2023
@dkuji
Copy link
Author

dkuji commented Jun 5, 2023

@TheWitness

Debug window confirmed.
When a search was performed during input, the request for action=get_node was executed about 800 times, with some taking about 60 seconds to respond.

graph_view.php?action=get_node&tree_id=0&id=tree_anchor-xxxx

action=ajax_search took about the same time.

In the case of copy and paste input, the request for action=get_node is executed only once and comes back in 114ms.
action=ajax_search took about the same time.

@dkuji
Copy link
Author

dkuji commented Jun 5, 2023

I believe I can effectively disable the setting by setting the key-up delay time to a very large value on my Cacti server.
(e.g. 1 hour (3600000 ms))

Is there any problem in this case?

@TheWitness
Copy link
Member

Yea, that would effectively disable it. The real question on such a small system is why all the delay? Are you using boost? What is the total size of your rra directory? du -hs rra?

@TheWitness
Copy link
Member

I define a large cacti server above 10k hosts and maybe 200k graphs.

@TheWitness
Copy link
Member

There are many cacti servers that large and many x times larger where x is confidential.

@dkuji
Copy link
Author

dkuji commented Jun 7, 2023

@TheWitness
rra directory size was 3.1G.

@TheWitness
Copy link
Member

Boost?

@dkuji
Copy link
Author

dkuji commented Jun 8, 2023

No, Boost is disabled.

@TheWitness
Copy link
Member

Enable it.

@dkuji
Copy link
Author

dkuji commented Jun 9, 2023

Thanks. I am new to the boost feature.
I read the documentation.
I understood that boost is a feature to improve IO performance by caching writes to RRD files.

This feature is not available on my Cacti server.

I can't use this feature on my Cacti server because the server has a script that parses the RRD file every 5 minutes.
If Boost is enabled, the RRD files are updated too slowly and the latest data cannot be parsed.

@TheWitness
Copy link
Member

What does that script parse? Is your RRA directory flash? Are you familiar with Data Source Statistics?

netniV pushed a commit that referenced this issue Jun 12, 2023
Increase keyup delay when searching the tree

For 1.3.x, also adds a setting and switches all keyup events that
make ajax calls to use delayKeyup instead of manually defining
each timer.

Closes #5368
@dkuji
Copy link
Author

dkuji commented Jun 15, 2023

It is analyzed using rrdtool.
The RRA directory is HDD.
This process is difficult to discontinue for a variety of reasons.

@TheWitness
Copy link
Member

What data are you grabbing from the RRDfiles?

@dkuji
Copy link
Author

dkuji commented Jun 19, 2023

Sorry, I cannot answer your question about the analysis of the rrd file as it is out of my scope.

I have changed the keyup delay to 3,600,000.
As expected, the search is no longer executed while typing. However, I am having trouble with the search not executing when I press enter after typing.

@netniV
Copy link
Member

netniV commented Jun 19, 2023

The search won't run because you hit enter. It's an automatic filter that appears based on KeyUp. You would have to customise the code more if you expect that kind of behaviour but that's not something we are preparing to do right now I'm afraid.

@TheWitness
Copy link
Member

Really, the you should be looking to why the database takes so long to respond. With over 1M graphs and 2.6M data sources, I have a little delay, but not like what you have. I suspect that:

  1. You system is un-derpowered
  2. You need to be on SSD/NVMe if you can not intelligently work with the system owner to fix their issue with over-querying RRDfiles.

It's likely what they are looking can be found in the DSStat's tables. But we can never know that without knowing what they are doing besides wrecking you system.

@netniV netniV changed the title Increase keyup delay when searching the tree When searching the tree, increase the time before querying for items Sep 3, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour enhancement General tag for an enhancement porting required Requires porting to develop resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

3 participants