npm search is very slow #3812
-
Your Environment
I have Verdaccio set up as a proxy to the npm registry. If I perform an If I take the request to the upstream server from the logs and perform it with What is Verdaccio doing with the search result before it is returned to the client? And why does it take so long? To Reproduce Perform Expected behavior I expect Screenshots, server logs, package manager log
Configuration File (cat ~/.config/verdaccio/config.yaml) #
# This is the default config file. It allows all users to do anything,
# so don't use it on production systems.
#
# Look here for more config file examples:
# https://github.com/verdaccio/verdaccio/tree/master/conf
#
# path to a directory with all packages
storage: /var/lib/verdaccio/.config/verdaccio/storage
# path to a directory with plugins to include
plugins: /var/lib/verdaccio/.config/verdaccio/plugins
web:
title: Company NPM
logo: company.png
primary_color: "#213978"
# comment out to disable gravatar support
# gravatar: false
# by default packages are ordercer ascendant (asc|desc)
# sort_packages: asc
auth:
activedirectory:
url: "******"
baseDN: '******'
domainSuffix: '******'
# htpasswd:
# file: ./htpasswd
# Maximum amount of users allowed to register, defaults to "+inf".
# You can set this to -1 to disable registration.
# max_users: 1000
# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
maxage: 30m
packages:
'@company/*':
access: $all
publish: $authenticated
# unpublish: $authenticated
'local-*':
access: $all
publish: $authenticated
# unpublish: $authenticated
'@*/*':
# scoped packages
access: $all
publish: $authenticated
# unpublish: $authenticated
proxy: npmjs
'**':
# allow all users (including non-authenticated users) to read and
# publish all packages
#
# you can specify usernames/groupnames (depending on your auth plugin)
# and three keywords: "$all", "$anonymous", "$authenticated"
access: $all
# allow all known users to publish/publish packages
# (anyone can register by default, remember?)
# publish: $authenticated
# unpublish: $authenticated
# if package is not available locally, proxy requests to 'npmjs' registry
proxy: npmjs
# You can specify HTTP/1.1 server keep alive timeout in seconds for incoming connections.
# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.
# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enough.
server:
keepAliveTimeout: 60
listen:
0.0.0.0:4873 # listen on all addresses (INADDR_ANY)
middlewares:
audit:
enabled: true
# log settings
logs: { type: stdout, format: pretty, level: http }
#experiments:
# # support for npm token command
# token: false Environment information
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Not much to be honest, you can see the code here: https://github.com/verdaccio/verdaccio/blob/5.x/src/lib/up-storage.ts#L524 Anyhow, you are using very old versions of Node.js, npm6 and not sure what effect that causes on it but probably something to consider, I dont think is slow but this has already been refactored in the version 6.x and still being tested, so next major will change anyway. |
Beta Was this translation helpful? Give feedback.
-
I have rolled out a new Verdaccio server using RHEL 9, Node 18.14.2, npm 9.5.0 and Verdaccio 5.25.0. npm search through Verdaccio is no longer slow. |
Beta Was this translation helpful? Give feedback.
-
Hi. I'm facing the same problem when using Verdaccio is running on kubernetes using the official image, version This is my config storage: /verdaccio/storage
auth:
htpasswd:
file: /verdaccio/conf/htpasswd
max_users: -1
middlewares:
audit:
enabled: true
uplinks:
npmjs:
url: https://registry.npmjs.org/
packages:
"@mycompany/*":
access: $authenticated
publish: <list of users>
"**":
access: $authenticated
publish: <list of users>
proxy: npmjs
max_body_size: 128mb
server:
keepAliveTimeout: 60
logs:
type: stdout
format: json
level: http
plugins: /verdaccio/plugins/ |
Beta Was this translation helpful? Give feedback.
Time is relative, I ignore your environment, but to mee looks just fine and is not a minute. Anyhow if you find any piece of code proves is causing the issue I'll be happy to dive more and improve it, or feel free to PR enhancements if you find something fixable.