Bugzilla – Attachment 165826 Details for
Bug 36721
Preload core libraries to speed up worker startup and reduce memory usage
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36721: Add -M Koha::Preload to preload libraries into starman master
Bug-36721-Add--M-KohaPreload-to-preload-libraries-.patch (text/plain), 2.55 KB, created by
David Cook
on 2024-04-30 06:31:32 UTC
(
hide
)
Description:
Bug 36721: Add -M Koha::Preload to preload libraries into starman master
Filename:
MIME Type:
Creator:
David Cook
Created:
2024-04-30 06:31:32 UTC
Size:
2.55 KB
patch
obsolete
>From 5ca79de76c643d54db886d88fa0ed11222b8a05b Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Tue, 30 Apr 2024 06:22:52 +0000 >Subject: [PATCH] Bug 36721: Add -M Koha::Preload to preload libraries into > starman master > >By preloading common libraries into starman master, we save memory >as starman master will share the memory addresses with its starman worker >processes. > >We will also save time because each individual worker won't need to load >these common modules. They'll already be done! > >To test: >0. Don't apply the patch yet >1. In koha-conf.xml, set the plack workers to a high number >2. Restart Plack >3. Note the memory usage using "free -m" > >4. Apply the patch >5. Restart Plack using "debian/scripts/koha-plack" >6. Note the memory usage using "free -m" >7. Memory usage should be significantly less (around 1GB with 16 workers) > >8. Comparing time is more difficult, but can be done before/after patch >using strace, top, or by modifying Koha/REST/V1.pm to output a timestamp >at the end of its load. Other ideas are also welcome. >--- > Koha/Preload.pm | 22 ++++++++++++++++++++++ > debian/scripts/koha-plack | 2 +- > 2 files changed, 23 insertions(+), 1 deletion(-) > create mode 100644 Koha/Preload.pm > >diff --git a/Koha/Preload.pm b/Koha/Preload.pm >new file mode 100644 >index 00000000000..37eb1790b8f >--- /dev/null >+++ b/Koha/Preload.pm >@@ -0,0 +1,22 @@ >+package Koha::Preload; >+ >+use Modern::Perl; >+use Mojo::Base 'Mojolicious'; >+use Mojolicious::Plugin::OAuth2; >+use Mojolicious::Plugin::OpenAPI; >+use Mojolicious::Plugin::OpenAPI::Cors; >+use Mojolicious::Plugin::OpenAPI::Security; >+use Mojolicious::Plugin::OpenAPI::SpecRenderer; >+use Mojolicious::Plugin::RenderFile; >+use Net::Netmask; >+use Plack::Middleware::ErrorDocument; >+use Plack::Middleware::HTTPExceptions; >+use Plack::Middleware::Log4perl; >+use Plack::Middleware::LogWarn; >+use Plack::Middleware::ReverseProxy; >+use Plack::Middleware::Static; >+use Plack::Response; >+ >+use Koha::Schema; >+ >+1; >diff --git a/debian/scripts/koha-plack b/debian/scripts/koha-plack >index 6fe18602680..160c21c63cf 100755 >--- a/debian/scripts/koha-plack >+++ b/debian/scripts/koha-plack >@@ -109,7 +109,7 @@ start_plack() > STARMAN="/usr/bin/perl -d ${STARMAN}" > fi > >- STARMANOPTS="-M FindBin ${max_requests_and_workers} \ >+ STARMANOPTS="-M Koha::Preload -M FindBin ${max_requests_and_workers} \ > --user=${instance_user} --group ${instancename}-koha \ > --pid ${PIDFILE} ${daemonize} ${logging} \ > -E ${environment} --socket ${PLACKSOCKET} ${PSGIFILE}" >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36721
: 165826