You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by hg...@apache.org on 2026/10/18 15:34:29 UTC
(iggy) 11/23: perf(server-ng): warm dummy password hash at boot
This is an automated email from the ASF dual-hosted git repository.
hubcio pushed a commit to branch http-listener
in repository https://gitbox.apache.org/repos/asf/iggy.git
commit 21f08ca5e632b19f4fb1168762edda6c36ba32d6
Author: Hubert Gruszecki <h....@gmail.com>
AuthorDate: Thu Jul 2 21:21:20 2026 +0200
perf(server-ng): warm dummy password hash at boot
The unknown-user dummy verify hash is a LazyLock, so the first login
with a missing username paid the one-time Argon2 init inside the
request. Force it during bootstrap instead.
---
core/server-ng/src/auth.rs | 6 ++++++
core/server-ng/src/bootstrap.rs | 2 ++
2 files changed, 8 insertions(+)
diff --git a/core/server-ng/src/auth.rs b/core/server-ng/src/auth.rs
index 16d9e0e21..19945c643 100644
--- a/core/server-ng/src/auth.rs
+++ b/core/server-ng/src/auth.rs
@@ -50,6 +50,12 @@ use tracing::warn;
static DUMMY_PASSWORD_HASH: LazyLock<String> =
LazyLock::new(|| crypto::hash_password("http-login-timing-guard"));
+/// Pay the one-time Argon2 cost of [`DUMMY_PASSWORD_HASH`] at boot instead of
+/// inside the first unknown-username login request.
+pub(crate) fn warm_dummy_password_hash() {
+ LazyLock::force(&DUMMY_PASSWORD_HASH);
+}
+
pub(crate) fn verify_login_credentials(
shard: &Rc<ServerNgShard>,
username: &str,
diff --git a/core/server-ng/src/bootstrap.rs b/core/server-ng/src/bootstrap.rs
index 87ba615da..d346699da 100644
--- a/core/server-ng/src/bootstrap.rs
+++ b/core/server-ng/src/bootstrap.rs
@@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.
+use crate::auth::warm_dummy_password_hash;
use crate::config_writer::write_current_config;
use crate::dispatch::{
make_client_request_handler, make_deferred_client_request_handler,
@@ -513,6 +514,7 @@ pub fn bootstrap(
config: ServerNgConfig,
current_replica_id: Option<u8>,
) -> Result<ShardHandles, ServerNgError> {
+ warm_dummy_password_hash();
let allocator = ShardAllocator::new(&config.system.sharding.cpu_allocation)
.map_err(ServerNgError::ShardAllocator)?;
let assignments = allocator