thunderclient / thunder-client-support

Thunder Client is a lightweight Rest API Client Extension for VS Code.
https://www.thunderclient.com
Other
3.61k stars 126 forks source link

ThunderClient CLI slow when thunder-tests Directory exists (sometimes, but not always) #1486

Closed snordmann closed 5 months ago

snordmann commented 6 months ago

Describe the bug In certain conditions, the ThunderClient CLI (running in a Kubernetes Pod) is slow (taking around 10 seconds), when the direcotry thunder-tests exists. When the thunder-tests directory does not exist, the ThunderClient CLI is fast (taking around 0.8-1 seconds).

It is unclear how the bug is reproducable, as it only happens in a specific Kubernetes cluster. The issue is not reproducable in other clusters. CPU and Memory Limits are identical, the AWS instance type is identical and the load on the Kubernets Nodes is similar (just 5 system pods running, no other application).

ThunderClient CLI is slow when running either collections, requests or curl commands. tc list is always fast (taking around 0.3 seconds).

This issue might be related to https://github.com/rangav/thunder-client-support/issues/1399. The ThunderClient CLI does report the time as spent in the preRequest phase.

To Reproduce

Execute the following things on the affected cluster:

$ kubectl run -i --tty --rm debug --image=node:21.6.2 --restart=Never -- bash
If you don't see a command prompt, try pressing enter.
root@debug:/# npm install -g @thunderclient/cli

added 1 package in 601ms
root@debug:/# time tc curl https://google.com >/dev/null
(node:19) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

real    0m1.007s
user    0m0.729s
sys     0m0.122s
root@debug:/# mkdir thunder-tests
root@debug:/# time tc curl https://google.com >/dev/null
(node:43) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

real    0m11.192s
user    0m10.963s
sys     0m0.100s
root@debug:/# rm -rf thunder-tests
root@debug:/# time tc curl https://google.com >/dev/null
(node:55) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

real    0m0.641s
user    0m0.373s
sys     0m0.061s
root@debug:/# exit
exit
pod "debug" deleted

It is unclear, why only the one cluster is that slow. Any help how we could narrow down the circumstances in which this issue occurs would be appreciated.

Expected behavior

The ThunderClient CLI should be fast, regardless of the existence of the thunder-tests directory.

Compare the affected cluster to the same exact commands on the unaffected cluster:

$ kubectl run -i --tty --rm debug --image=node:21.6.2 --restart=Never -- bash
If you don't see a command prompt, try pressing enter.
root@debug:/# npm install -g @thunderclient/cli

added 1 package in 758ms
root@debug:/# time tc curl https://google.com >/dev/null
(node:19) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

real    0m1.133s
user    0m0.743s
sys     0m0.104s
root@debug:/# mkdir thunder-tests
root@debug:/# time tc curl https://google.com >/dev/null
(node:43) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

real    0m0.807s
user    0m0.561s
sys     0m0.088s
root@debug:/# rm -rf thunder-tests
root@debug:/# time tc curl https://google.com >/dev/null
(node:55) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

real    0m0.720s
user    0m0.459s
sys     0m0.047s
root@debug:/# exit
exit
pod "debug" deleted

Platform:

Are you using the free version/paid version/trial:

Paid

rangav commented 6 months ago

Hi @snordmann

Thanks for reporting the issue.

Can you please confirm your company details using the below form https://www.thunderclient.com/contact

rangav commented 6 months ago

We have made changes to fix this issue and recorded additional timings to better understand the issue.

Can you please update CLI to v1.12.1 and test it?

Please share the JSON report again after testing.

snordmann commented 5 months ago

Hi @rangav

thank you for your support in this issue.

For everyone that wondered about this issue history: Due to company data in the test cases all communication about this issue was held via email and not in this public issue. Long story short: In version v1.12.10 the slowness was fixed.

Now our test suite that previously took 2 minutes is completed within 12 seconds.

Again, thank you @rangav