* jemalloc

* featurizeP

---------

Co-authored-by: Wyatt Verchere <wverchere@gmail.com>
This commit is contained in:
Geometrically
2024-01-27 18:13:52 -05:00
committed by GitHub
parent fc577241bd
commit 5b63b0b398
5 changed files with 52 additions and 10 deletions

28
Cargo.lock generated
View File

@@ -1633,6 +1633,12 @@ dependencies = [
"percent-encoding",
]
[[package]]
name = "fs_extra"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
[[package]]
name = "funty"
version = "2.0.0"
@@ -2222,6 +2228,27 @@ version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
[[package]]
name = "jemalloc-sys"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45"
dependencies = [
"cc",
"fs_extra",
"libc",
]
[[package]]
name = "jemallocator"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69"
dependencies = [
"jemalloc-sys",
"libc",
]
[[package]]
name = "jobserver"
version = "0.1.27"
@@ -2309,6 +2336,7 @@ dependencies = [
"hyper-tls",
"image",
"itertools 0.12.0",
"jemallocator",
"json-patch",
"lazy_static",
"lettre",

View File

@@ -108,6 +108,8 @@ lettre = "0.11.3"
derive-new = "0.6.0"
rust_iso3166 = "0.1.11"
jemallocator = {version = "0.3.2", optional = true}
[dev-dependencies]
actix-http = "3.4.0"
json-patch = "*"
@@ -116,3 +118,6 @@ opt-level = 0 # Minimal optimization, speeds up compilation
lto = false # Disables Link Time Optimization
incremental = true # Enables incremental compilation
codegen-units = 16 # Higher number can improve compile times but reduce runtime performance
[features]
jemalloc = ["jemallocator"]

View File

@@ -9,7 +9,7 @@ COPY docker_utils/dummy.rs .
# Change temporarely the path of the code
RUN sed -i 's|src/main.rs|dummy.rs|' Cargo.toml
# Build only deps
RUN cargo build --release
RUN cargo build --release --features jemalloc
# Now return the file back to normal
RUN sed -i 's|dummy.rs|src/main.rs|' Cargo.toml
@@ -17,7 +17,7 @@ RUN sed -i 's|dummy.rs|src/main.rs|' Cargo.toml
COPY . .
# Build our code
ARG SQLX_OFFLINE=true
RUN cargo build --release
RUN cargo build --release --features jemalloc
# Final Stage
FROM ubuntu:latest

View File

@@ -12,6 +12,10 @@ use labrinth::{check_env_vars, clickhouse, database, file_hosting, queue};
use log::{error, info};
use std::sync::Arc;
#[cfg(feature = "jemalloc")]
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
#[derive(Clone)]
pub struct Pepper {
pub pepper: String,

View File

@@ -115,14 +115,19 @@ pub async fn get_indexes_for_indexing(
let client = config.make_client();
let project_name = config.get_index_name("projects", next);
let project_filtered_name = config.get_index_name("projects_filtered", next);
let projects_index = create_or_update_index(&client, &project_name, Some(&[
"words",
"typo",
"proximity",
"attribute",
"exactness",
"sort",
]),).await?;
let projects_index = create_or_update_index(
&client,
&project_name,
Some(&[
"words",
"typo",
"proximity",
"attribute",
"exactness",
"sort",
]),
)
.await?;
let projects_filtered_index = create_or_update_index(
&client,
&project_filtered_name,