Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
conduwuit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
🥺
conduwuit
Commits
06fccbc3
Commit
06fccbc3
authored
1 year ago
by
🥺
Browse files
Options
Downloads
Patches
Plain Diff
debug log before and after nofile soft limit increases
Signed-off-by:
June
<
june@girlboss.ceo
>
parent
fbd8090b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.rs
+21
-14
21 additions, 14 deletions
src/main.rs
with
21 additions
and
14 deletions
src/main.rs
+
21
−
14
View file @
06fccbc3
...
...
@@ -40,7 +40,7 @@
trace
::
TraceLayer
,
ServiceBuilderExt
as
_
,
};
use
tracing
::{
error
,
info
,
warn
};
use
tracing
::{
debug
,
error
,
info
,
warn
};
use
tracing_subscriber
::{
prelude
::
*
,
EnvFilter
};
pub
use
conduit
::
*
;
// Re-export everything from the library crate
...
...
@@ -54,17 +54,7 @@
#[tokio::main]
async
fn
main
()
{
// This is needed for opening lots of file descriptors, which tends to
// happen more often when using RocksDB and making lots of federation
// connections at startup. The soft limit is usually 1024, and the hard
// limit is usually 512000; I've personally seen it hit >2000.
//
// * https://www.freedesktop.org/software/systemd/man/systemd.exec.html#id-1.12.2.1.17.6
// * https://github.com/systemd/systemd/commit/0abf94923b4a95a7d89bc526efc84e7ca2b71741
#[cfg(unix)]
maximize_fd_limit
()
.expect
(
"should be able to increase the soft limit to the hard limit"
);
// Initialize DB
// Initialize config
let
raw_config
=
Figment
::
new
()
.merge
(
...
...
@@ -135,6 +125,16 @@ async fn main() {
tracing
::
subscriber
::
set_global_default
(
subscriber
)
.unwrap
();
}
// This is needed for opening lots of file descriptors, which tends to
// happen more often when using RocksDB and making lots of federation
// connections at startup. The soft limit is usually 1024, and the hard
// limit is usually 512000; I've personally seen it hit >2000.
//
// * https://www.freedesktop.org/software/systemd/man/systemd.exec.html#id-1.12.2.1.17.6
// * https://github.com/systemd/systemd/commit/0abf94923b4a95a7d89bc526efc84e7ca2b71741
#[cfg(unix)]
maximize_fd_limit
()
.expect
(
"should be able to increase the soft limit to the hard limit"
);
info!
(
"Loading database"
);
if
let
Err
(
error
)
=
KeyValueDatabase
::
load_or_create
(
config
)
.await
{
error!
(
?
error
,
"The database couldn't be loaded or created"
);
...
...
@@ -569,12 +569,19 @@ fn method_to_filter(method: Method) -> MethodFilter {
}
#[cfg(unix)]
#[tracing::instrument(err)]
fn
maximize_fd_limit
()
->
Result
<
(),
nix
::
errno
::
Errno
>
{
use
nix
::
sys
::
resource
::{
getrlimit
,
setrlimit
,
Resource
};
let
res
=
Resource
::
RLIMIT_NOFILE
;
let
(
_
,
hard_limit
)
=
getrlimit
(
res
)
?
;
let
(
soft_limit
,
hard_limit
)
=
getrlimit
(
res
)
?
;
debug!
(
"Current nofile soft limit: {soft_limit}"
);
setrlimit
(
res
,
hard_limit
,
hard_limit
)
setrlimit
(
res
,
hard_limit
,
hard_limit
)
?
;
debug!
(
"Increased nofile soft limit to {hard_limit}"
);
Ok
(())
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment