ISSUE - CLI is very, very slow

Hi there,

I’m finding that CLI commands are frequently (but not always) very slow on my 64-bit Windows 10 machine using a plain cmd.exe window. For example:

'particle --version' took 27 seconds to execute
'particle help' took 23 seconds to execute
'particle whoami' took 24 seconds to execute

Repeating this commands sometimes took equally long but also sometimes was faster:

Repeating 'particle whoami' took 24 seconds again
Repeating 'particle whoami' yet again took only 2 seconds -- odd
Repeating 'particle whoami' yet again took 23 seconds
Repeating 'particle help' took 23 seconds
Repeating 'particle help' yet again took only 4 seconds -- odd
Repeating 'particle help' yet again took 24 seconds

I chose the above commands as tests because they do not need to invoke the usb drivers or any particle hardware, but similar delays exist if I try to access my photon, argon or boron hardware using e.g. particle identify.

I’m not sure what’s going on so I checked and updated npn and node and re-installed CLI using the standard Windows Installer.

npm -v gives 8.11.0 
node -v gives v16.16.0
particle version gives 3.2.0

I also used the Task Manager to check if there was excessive use by other Windows processes and I temporarily disabled Windows Defender Antivirus. There were a few temporary blips during the wait period where the highest CPU consuming process rose to 4% but most of the time it was always below 1%.

The contents of my particle directory is as follows:

06/08/2022  11:02 PM    <DIR>          .npm-cache
07/18/2022  04:57 PM                53 autoupdate
07/14/2022  10:34 AM    <DIR>          bin
07/18/2022  06:49 PM           467,156 error.log
03/26/2020  06:35 PM    <DIR>          node-v12.16.1-windows-x64
06/08/2022  11:02 PM    <DIR>          node_modules
07/14/2022  10:35 AM    <DIR>          NSIS-Tool.3.0.8
06/08/2022  11:02 PM           469,622 package-lock.json
06/08/2022  11:02 PM                59 plugin-cache.json
03/26/2020  06:35 PM    <DIR>          tmp
07/14/2022  10:35 AM           160,842 Uninstall.exe

I’ve lived with this for a while, but since Particle Workbench seems to use CLI under the hood, my Workbench workflow is heavily impacted + as a professor I am wondering how I can expect my students to use this tool if it behaves in this way.

I suspect the problem lies somehow with my machine rather than CLI, but I experienced a similar problem on another machine a few years ago. Anyway, any help or suggestions would be much appreciated.

@jpeytonj, I run CLI on Win10x64 and commands run in sub 3 secs. However, I installed the CLI using the Particle CLI installer and not with separate npm and node installations.

1 Like

I also experience quite long response times for the first time running particle ... in a new cmd/powershell session, but after that they act in an instant.

So if you intend to run several commands, keep the command line window open and reuse.

And as Paul said, on Windows you should use the CLI installer.

1 Like

Hi,

I guess it can also matter how far away you are from the Particle infrastructure and what is the network connection your computer has to the internet.

I can’t say for sure since I have no info, but I heard people requesting to Particle in the past to provide cloud infrastructure (I guess this is called geographical redundancy or service, or similar, I forgot) in other parts of the world to speed up communication with the PArticle cloud. I think at the time the person was sitting in Australia. It could be that the Particle infrastructure resides in the US, so the farther away you are, the slower the connection. But this was years ago and I have very little info about this.

Also, you mention you are a professor, so if you are connected to a school wifi network where everyone in the school shares the connection to the internet, the more people request stuff, the less bandwidth you get for this type of request (or any request, for that matter).
Does it happen the same at home? Does it happen the same if you temporarily connect via a hotspot on your phone?

Wild guesses, since I know very little about your situation.
Best,
Gustavo.

To clarify, I did in fact use the recommended Particle CLI Installer, (though I was re-installing over an old version). When this didn’t help, I checked the versions of npm and node and updated them because the installer did not seem to have done this. Still no joy.

I have just uninstalled CLI (using the uninstall CLI program) and then re-installed CLI yet again, just to be sure. This time (although the installer completed ok) there was an error reported (see screenshot below). CLI seemed to work ok, but still very slow.

I was worried about the reported error, so I ran the Particle CLI Installer yet again(!), - without first uninstalling CLI, and this time it completed without any reported errors – but CLI is still very slow :slightly_frowning_face:

Thank you: Yes, it is certainly slow the first time and I had noted this from other posts you have made, but:

  • It is slow not just for the first CLI command, but for each new type of command (eg. particle version, versus particle help)

  • It is then (sometimes) faster if I repeat these commands a few times, but if I come back to the same command a short while later (eg. after using some other commands) it is slow again.

  • My original post shows several repeated commands issued in sequence in the same cmd window session, and the results are frustratingly inconsistent.

Do you know why CLI is slow the first time and how it ‘remembers’ (or in my case potentially ‘forgets’) prior usage?

In this respect I’d go with @gusgonnet’s “suspicion” that it might have something to do with your network infrastructure “closing” the route after a while being “dormant”.
Try another - less crowded and/or less restrictively governed - network.

Thank you for your suggestions but I would be surprised if this is a location problem. I first experienced it in the USA both on campus (with high bandwidth), and at home. The behavior has not changed even though I am now in the UK. That said, it would be interesting to know if a command like particle help executes entirely locally, or whether all CLI commands access the Particle Cloud infrastructure.

Since CLI keeps your login status I’m pretty positive it (at least when still logged in) will check in with the cloud.
However, you could do a check by calling particle logout and then run your tests with purely local commands again.

Thank you: I tested the CLI response times with, and without being logged in and it didn’t make any difference. I also thought it would be worth testing if there was a location-dependent communication delay by sending a request using something other than CLI, eg. curl https://api.particle.io/v1/user?access_token=xxxx. This time it responded almost instantaneously, so I think the problem is somehow with my machine and CLI and/or network/security.

I’ve reached out to our own IT / network support team, but no response yet. In the meantime, I wondered if something is messing me up from prior CLI / Particle Dev / Particle Workbench installations etc. Other than running CLI uninstall, is there anything else I can do to get back to a really clean slate?