<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>A new request with request id 18714 has been created by koha-devel-request@lists.koha-community.org. Short info on the request is : <br><br>Title : Koha-devel Digest, Vol 185, Issue 16<br>Category : <br>Description : <div>Send Koha-devel mailing list submissions to<br>    koha-devel@lists.koha-community.org<br><br>To subscribe or unsubscribe via the World Wide Web, visit<br>    https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>or, via email, send a message with subject or body 'help' to<br>    koha-devel-request@lists.koha-community.org<br><br>You can reach the person managing the list at<br>    koha-devel-owner@lists.koha-community.org<br><br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of Koha-devel digest..."<br><br><br>Today's Topics:<br><br>   1. Re: Optimizing Starman startup (dcook@prosentient.com.au)<br>   2. Re: Optimizing Starman startup (dcook@prosentient.com.au)<br>   3. Re: Optimizing Starman startup (dcook@prosentient.com.au)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Wed, 21 Apr 2021 10:28:23 +1000<br>From: <dcook@prosentient.com.au><br>To: "'Ere Maijala'" <ere.maijala@helsinki.fi>,<br>    <koha-devel@lists.koha-community.org><br>Subject: Re: [Koha-devel] Optimizing Starman startup<br>Message-ID: <01ed01d73645$3cdf7600$b69e6200$@prosentient.com.au><br>Content-Type: text/plain;    charset="UTF-8"<br><br>Hi Ere,<br><br>Thanks for your reply. 24700 looks much better. I'll look at backporting it locally.<br><br>Although I'm looking at JSON::Validator::OpenAPI::Mojolicious at https://metacpan.org/pod/release/JHTHORSEN/Mojolicious-Plugin-OpenAPI-2.19/lib/JSON/Validator/OpenAPI/Mojolicious.pm and it says "Do not use this module directly. Use Mojolicious::Plugin::OpenAPI instead." I notice that you're using the "bundle" method. Do we really need that there? Why don't we just load the JSON using the JSON module, merge with the plugin spec files, and then pass it to the OpenAPI plugin? Shouldn't the plugin take care of the $ref replacement?<br><br>Hmm... I didn't realize until now that the OpenAPI plugin was doing a validate behind the scenes. That's tricky. <br><br>At a glance, we might be able to pre-load the app into the Starman master process pre-fork. There are warnings about doing that with open database connections, so we'd need to review plack.psgi, but a quick glance suggests it might be OK. (Alternatively, I have wondered about running the REST API as a separate process apart from Starman using hypnotoad. According to https://docs.mojolicious.org/Mojolicious/Guides/Cookbook, Mojo::Server::Prefork preloads the application in the manager/master process, and Hypnotoad is based off that, so that would help.)<br><br>It does seem like changes to the OpenAPI plugin would be needed for caching. <br><br>I'm going to try backporting your change and try pre-loading and see how far that gets me. <br><br>David Cook<br>Software Engineer<br>Prosentient Systems<br>Suite 7.03<br>6a Glen St<br>Milsons Point NSW 2061<br>Australia<br><br>Office: 02 9212 0899<br>Online: 02 8005 0595<br><br>-----Original Message-----<br>From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On Behalf Of Ere Maijala<br>Sent: Tuesday, 20 April 2021 4:48 PM<br>To: koha-devel@lists.koha-community.org<br>Subject: Re: [Koha-devel] Optimizing Starman startup<br><br>Hi,<br><br>I did some work on improving it here:<br><br>https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24700<br><br>That shaved a good bit of time from it, but it's still a heavy operation, and it would make sense to<br><br>1.) avoid doing it too often<br><br>2.) cache the results and avoid doing it if results are cached<br><br>If you could address the first one, that'd go a long way. I'm afraid the second one would require changes to the OpenAPI plugin to support caching.<br><br>--Ere<br><br>dcook@prosentient.com.au kirjoitti 20.4.2021 klo 6.15:<br>> Hi all,<br>> <br>> Do you despair when you see the following periodically in “top” when a <br>> starman worker is recreated ?<br>> <br>>    PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ <br>> COMMAND<br>> <br>> 9529 my-koha  20   0  460108 197212  17172 R 100.0  0.4   0:03.41 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> Or the following in top when you install koha-common package or <br>> restart the koha-common service?<br>> <br>> 11101 1-koha  20   0  447232 193320  16076 R   10.6  0.4   0:09.09 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11168 1-koha  20   0  447240 193264  16056 R   10.6  0.4   0:08.72 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11306 2-koha  20   0  447220 193148  16000 R   10.6  0.4   0:08.07 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11543 2-koha  20   0  447232 193036  15828 R   10.6  0.4   0:07.07 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11784 3-koha  20   0  441536 189664  16172 R   10.6  0.4   0:06.04 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11830 3-koha  20   0  439548 187212  15748 R   10.6  0.4   0:05.82 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11831 4-koha  20   0  438620 186344  15748 R   10.6  0.4   0:05.81 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11853 4-koha  20   0  437680 185672  16000 R   10.6  0.4   0:05.79 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> Well, I still have a lot of investigation left to do, but I notice 1 <br>> place that a lot of time taken is here (per worker):<br>> <br>>      my $validator = JSON::Validator::OpenAPI::Mojolicious->new;<br>> <br>>      $validator->load_and_validate_schema(<br>> <br>>          $self->home->rel_file("api/v1/swagger/swagger.json"),<br>> <br>>          {<br>> <br>>            allow_invalid_ref  => 1,<br>> <br>>          }<br>> <br>>        );<br>> <br>>      push @{$self->routes->namespaces}, 'Koha::Plugin';<br>> <br>>      my $spec = $validator->schema->data;<br>> <br>>      $self->plugin(<br>> <br>>          'Koha::REST::Plugin::PluginRoutes' => {<br>> <br>>              spec      => $spec,<br>> <br>>              validator => $validator<br>> <br>>          }<br>> <br>>      );<br>> <br>>      $self->plugin(<br>> <br>>          OpenAPI => {<br>> <br>>              spec  => $spec,<br>> <br>>              route => <br>> $self->routes->under('/api/v1')->to('Auth#under'),<br>> <br>>              allow_invalid_ref =><br>> <br>>                1,    # required by our spec because $ref directly <br>> under<br>> <br>>                      # Paths-, Parameters-, Definitions- & Info-object<br>> <br>>                      # is not allowed by the OpenAPI specification.<br>> <br>>          }<br>> <br>> );<br>> <br>> Anyone have ideas for improving this? Do we have to validate the <br>> schema every time? Can we move the schema validation into a different <br>> module and preload it into Starman using the -M flag so that it’s done <br>> 1 time per Starman master instance rather than 1 time per Starman worker instance?<br>> <br>> I find “/usr/share/koha/api/v1/app.pl” to be the bane of deployments, <br>> as it puts a massive load on a server, when you have multiple Koha <br>> instances on the server.<br>> <br>> David Cook<br>> <br>> Software Engineer<br>> <br>> Prosentient Systems<br>> <br>> Suite 7.03<br>> <br>> 6a Glen St<br>> <br>> Milsons Point NSW 2061<br>> <br>> Australia<br>> <br>> Office: 02 9212 0899<br>> <br>> Online: 02 8005 0595<br>> <br>> <br>> _______________________________________________<br>> Koha-devel mailing list<br>> Koha-devel@lists.koha-community.org<br>> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>> website : https://www.koha-community.org/ git : <br>> https://git.koha-community.org/ bugs : <br>> https://bugs.koha-community.org/<br>> <br><br>--<br>Ere Maijala<br>Kansalliskirjasto / The National Library of Finland _______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org<br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/ git : https://git.koha-community.org/ bugs : https://bugs.koha-community.org/<br><br><br><br><br>------------------------------<br><br>Message: 2<br>Date: Wed, 21 Apr 2021 10:46:25 +1000<br>From: <dcook@prosentient.com.au><br>To: "'Ere Maijala'" <ere.maijala@helsinki.fi>,<br>    <koha-devel@lists.koha-community.org><br>Subject: Re: [Koha-devel] Optimizing Starman startup<br>Message-ID: <01f401d73647$c205b1d0$46111570$@prosentient.com.au><br>Content-Type: text/plain;    charset="UTF-8"<br><br>Thanks for that optimization. My restart time has gone from 2 minutes 45 seconds to 1 minute 30 seconds. Much better.<br><br>Now I'm going to try the preload and see if I can get it down to 45 seconds or better...<br><br>David Cook<br>Software Engineer<br>Prosentient Systems<br>Suite 7.03<br>6a Glen St<br>Milsons Point NSW 2061<br>Australia<br><br>Office: 02 9212 0899<br>Online: 02 8005 0595<br><br>-----Original Message-----<br>From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On Behalf Of dcook@prosentient.com.au<br>Sent: Wednesday, 21 April 2021 10:28 AM<br>To: 'Ere Maijala' <ere.maijala@helsinki.fi>; koha-devel@lists.koha-community.org<br>Subject: Re: [Koha-devel] Optimizing Starman startup<br><br>Hi Ere,<br><br>Thanks for your reply. 24700 looks much better. I'll look at backporting it locally.<br><br>Although I'm looking at JSON::Validator::OpenAPI::Mojolicious at https://metacpan.org/pod/release/JHTHORSEN/Mojolicious-Plugin-OpenAPI-2.19/lib/JSON/Validator/OpenAPI/Mojolicious.pm and it says "Do not use this module directly. Use Mojolicious::Plugin::OpenAPI instead." I notice that you're using the "bundle" method. Do we really need that there? Why don't we just load the JSON using the JSON module, merge with the plugin spec files, and then pass it to the OpenAPI plugin? Shouldn't the plugin take care of the $ref replacement?<br><br>Hmm... I didn't realize until now that the OpenAPI plugin was doing a validate behind the scenes. That's tricky. <br><br>At a glance, we might be able to pre-load the app into the Starman master process pre-fork. There are warnings about doing that with open database connections, so we'd need to review plack.psgi, but a quick glance suggests it might be OK. (Alternatively, I have wondered about running the REST API as a separate process apart from Starman using hypnotoad. According to https://docs.mojolicious.org/Mojolicious/Guides/Cookbook, Mojo::Server::Prefork preloads the application in the manager/master process, and Hypnotoad is based off that, so that would help.)<br><br>It does seem like changes to the OpenAPI plugin would be needed for caching. <br><br>I'm going to try backporting your change and try pre-loading and see how far that gets me. <br><br>David Cook<br>Software Engineer<br>Prosentient Systems<br>Suite 7.03<br>6a Glen St<br>Milsons Point NSW 2061<br>Australia<br><br>Office: 02 9212 0899<br>Online: 02 8005 0595<br><br>-----Original Message-----<br>From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On Behalf Of Ere Maijala<br>Sent: Tuesday, 20 April 2021 4:48 PM<br>To: koha-devel@lists.koha-community.org<br>Subject: Re: [Koha-devel] Optimizing Starman startup<br><br>Hi,<br><br>I did some work on improving it here:<br><br>https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24700<br><br>That shaved a good bit of time from it, but it's still a heavy operation, and it would make sense to<br><br>1.) avoid doing it too often<br><br>2.) cache the results and avoid doing it if results are cached<br><br>If you could address the first one, that'd go a long way. I'm afraid the second one would require changes to the OpenAPI plugin to support caching.<br><br>--Ere<br><br>dcook@prosentient.com.au kirjoitti 20.4.2021 klo 6.15:<br>> Hi all,<br>> <br>> Do you despair when you see the following periodically in “top” when a <br>> starman worker is recreated ?<br>> <br>>    PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ <br>> COMMAND<br>> <br>> 9529 my-koha  20   0  460108 197212  17172 R 100.0  0.4   0:03.41 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> Or the following in top when you install koha-common package or <br>> restart the koha-common service?<br>> <br>> 11101 1-koha  20   0  447232 193320  16076 R   10.6  0.4   0:09.09 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11168 1-koha  20   0  447240 193264  16056 R   10.6  0.4   0:08.72 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11306 2-koha  20   0  447220 193148  16000 R   10.6  0.4   0:08.07 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11543 2-koha  20   0  447232 193036  15828 R   10.6  0.4   0:07.07 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11784 3-koha  20   0  441536 189664  16172 R   10.6  0.4   0:06.04 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11830 3-koha  20   0  439548 187212  15748 R   10.6  0.4   0:05.82 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11831 4-koha  20   0  438620 186344  15748 R   10.6  0.4   0:05.81 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11853 4-koha  20   0  437680 185672  16000 R   10.6  0.4   0:05.79 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> Well, I still have a lot of investigation left to do, but I notice 1 <br>> place that a lot of time taken is here (per worker):<br>> <br>>      my $validator = JSON::Validator::OpenAPI::Mojolicious->new;<br>> <br>>      $validator->load_and_validate_schema(<br>> <br>>          $self->home->rel_file("api/v1/swagger/swagger.json"),<br>> <br>>          {<br>> <br>>            allow_invalid_ref  => 1,<br>> <br>>          }<br>> <br>>        );<br>> <br>>      push @{$self->routes->namespaces}, 'Koha::Plugin';<br>> <br>>      my $spec = $validator->schema->data;<br>> <br>>      $self->plugin(<br>> <br>>          'Koha::REST::Plugin::PluginRoutes' => {<br>> <br>>              spec      => $spec,<br>> <br>>              validator => $validator<br>> <br>>          }<br>> <br>>      );<br>> <br>>      $self->plugin(<br>> <br>>          OpenAPI => {<br>> <br>>              spec  => $spec,<br>> <br>>              route =><br>> $self->routes->under('/api/v1')->to('Auth#under'),<br>> <br>>              allow_invalid_ref =><br>> <br>>                1,    # required by our spec because $ref directly <br>> under<br>> <br>>                      # Paths-, Parameters-, Definitions- & Info-object<br>> <br>>                      # is not allowed by the OpenAPI specification.<br>> <br>>          }<br>> <br>> );<br>> <br>> Anyone have ideas for improving this? Do we have to validate the <br>> schema every time? Can we move the schema validation into a different <br>> module and preload it into Starman using the -M flag so that it’s done<br>> 1 time per Starman master instance rather than 1 time per Starman worker instance?<br>> <br>> I find “/usr/share/koha/api/v1/app.pl” to be the bane of deployments, <br>> as it puts a massive load on a server, when you have multiple Koha <br>> instances on the server.<br>> <br>> David Cook<br>> <br>> Software Engineer<br>> <br>> Prosentient Systems<br>> <br>> Suite 7.03<br>> <br>> 6a Glen St<br>> <br>> Milsons Point NSW 2061<br>> <br>> Australia<br>> <br>> Office: 02 9212 0899<br>> <br>> Online: 02 8005 0595<br>> <br>> <br>> _______________________________________________<br>> Koha-devel mailing list<br>> Koha-devel@lists.koha-community.org<br>> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>> website : https://www.koha-community.org/ git : <br>> https://git.koha-community.org/ bugs : <br>> https://bugs.koha-community.org/<br>> <br><br>--<br>Ere Maijala<br>Kansalliskirjasto / The National Library of Finland _______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org<br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/ git : https://git.koha-community.org/ bugs : https://bugs.koha-community.org/<br><br><br>_______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org<br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/ git : https://git.koha-community.org/ bugs : https://bugs.koha-community.org/<br><br><br><br><br>------------------------------<br><br>Message: 3<br>Date: Wed, 21 Apr 2021 12:11:55 +1000<br>From: <dcook@prosentient.com.au><br>To: "'Ere Maijala'" <ere.maijala@helsinki.fi>,<br>    <koha-devel@lists.koha-community.org><br>Subject: Re: [Koha-devel] Optimizing Starman startup<br>Message-ID: <01fd01d73653$b39e7210$1adb5630$@prosentient.com.au><br>Content-Type: text/plain;    charset="UTF-8"<br><br>That was an interesting experience.<br><br>When you run koha-plack --start, it spins through a long list of instances quickly, because it returns immediately after starting the Starman master, which doesn't really do much, but fork off worker processes, which then consume a huge amount of resources concurrently. <br><br>However, when you preload the app using --preload-app, the resource consumption is in the Starman master, and the command doesn't return until after the Starman master has loaded the app. So you synchronously move through the list 1 by 1.<br><br>This has pros and cons.<br><br>Pro: You can start 60 Koha instances with very little resource usage, because you're only starting 1 Koha at a time. Yay!<br>Con: "service koha-common restart" will stop all Plack instances and then start them all. This is suboptimal, as it took me about 3.5 minutes to start 60 Koha instances. That's a lot of downtime for the last Koha instance in that list. <br><br>Of course, we could change "koha-common" init service to actually restart instead of stop/start on a "restart" action. <br><br>But the other gotcha is Debian package installs/upgrades (hello continuous deployment). According to https://manpages.debian.org/testing/debhelper/dh_installinit.1.en.html, the init script is "stopped" in the prerm and "started" in the postinst. The documentation is not clear if it's at the start or end of postinst...) Based on my review of syslog and /var/log/apt/history.log, it looks like it's actually started at the beginning of postinst, which is before koha-schema-upgrade actually runs. I suppose that makes sense as that should put Koha into maintenance mode until the schema upgrade completes... <br><br>Operations is so not fun heh.<br><br>Really at the end of the day I guess it comes back to trying to optimize that OpenAPI plugin to reduce the resource consumption and resulting downtime. <br><br>David Cook<br>Software Engineer<br>Prosentient Systems<br>Suite 7.03<br>6a Glen St<br>Milsons Point NSW 2061<br>Australia<br><br>Office: 02 9212 0899<br>Online: 02 8005 0595<br><br>-----Original Message-----<br>From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On Behalf Of dcook@prosentient.com.au<br>Sent: Wednesday, 21 April 2021 10:46 AM<br>To: 'Ere Maijala' <ere.maijala@helsinki.fi>; koha-devel@lists.koha-community.org<br>Subject: Re: [Koha-devel] Optimizing Starman startup<br><br>Thanks for that optimization. My restart time has gone from 2 minutes 45 seconds to 1 minute 30 seconds. Much better.<br><br>Now I'm going to try the preload and see if I can get it down to 45 seconds or better...<br><br>David Cook<br>Software Engineer<br>Prosentient Systems<br>Suite 7.03<br>6a Glen St<br>Milsons Point NSW 2061<br>Australia<br><br>Office: 02 9212 0899<br>Online: 02 8005 0595<br><br>-----Original Message-----<br>From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On Behalf Of dcook@prosentient.com.au<br>Sent: Wednesday, 21 April 2021 10:28 AM<br>To: 'Ere Maijala' <ere.maijala@helsinki.fi>; koha-devel@lists.koha-community.org<br>Subject: Re: [Koha-devel] Optimizing Starman startup<br><br>Hi Ere,<br><br>Thanks for your reply. 24700 looks much better. I'll look at backporting it locally.<br><br>Although I'm looking at JSON::Validator::OpenAPI::Mojolicious at https://metacpan.org/pod/release/JHTHORSEN/Mojolicious-Plugin-OpenAPI-2.19/lib/JSON/Validator/OpenAPI/Mojolicious.pm and it says "Do not use this module directly. Use Mojolicious::Plugin::OpenAPI instead." I notice that you're using the "bundle" method. Do we really need that there? Why don't we just load the JSON using the JSON module, merge with the plugin spec files, and then pass it to the OpenAPI plugin? Shouldn't the plugin take care of the $ref replacement?<br><br>Hmm... I didn't realize until now that the OpenAPI plugin was doing a validate behind the scenes. That's tricky. <br><br>At a glance, we might be able to pre-load the app into the Starman master process pre-fork. There are warnings about doing that with open database connections, so we'd need to review plack.psgi, but a quick glance suggests it might be OK. (Alternatively, I have wondered about running the REST API as a separate process apart from Starman using hypnotoad. According to https://docs.mojolicious.org/Mojolicious/Guides/Cookbook, Mojo::Server::Prefork preloads the application in the manager/master process, and Hypnotoad is based off that, so that would help.)<br><br>It does seem like changes to the OpenAPI plugin would be needed for caching. <br><br>I'm going to try backporting your change and try pre-loading and see how far that gets me. <br><br>David Cook<br>Software Engineer<br>Prosentient Systems<br>Suite 7.03<br>6a Glen St<br>Milsons Point NSW 2061<br>Australia<br><br>Office: 02 9212 0899<br>Online: 02 8005 0595<br><br>-----Original Message-----<br>From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On Behalf Of Ere Maijala<br>Sent: Tuesday, 20 April 2021 4:48 PM<br>To: koha-devel@lists.koha-community.org<br>Subject: Re: [Koha-devel] Optimizing Starman startup<br><br>Hi,<br><br>I did some work on improving it here:<br><br>https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24700<br><br>That shaved a good bit of time from it, but it's still a heavy operation, and it would make sense to<br><br>1.) avoid doing it too often<br><br>2.) cache the results and avoid doing it if results are cached<br><br>If you could address the first one, that'd go a long way. I'm afraid the second one would require changes to the OpenAPI plugin to support caching.<br><br>--Ere<br><br>dcook@prosentient.com.au kirjoitti 20.4.2021 klo 6.15:<br>> Hi all,<br>> <br>> Do you despair when you see the following periodically in “top” when a <br>> starman worker is recreated ?<br>> <br>>    PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ <br>> COMMAND<br>> <br>> 9529 my-koha  20   0  460108 197212  17172 R 100.0  0.4   0:03.41 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> Or the following in top when you install koha-common package or <br>> restart the koha-common service?<br>> <br>> 11101 1-koha  20   0  447232 193320  16076 R   10.6  0.4   0:09.09 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11168 1-koha  20   0  447240 193264  16056 R   10.6  0.4   0:08.72 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11306 2-koha  20   0  447220 193148  16000 R   10.6  0.4   0:08.07 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11543 2-koha  20   0  447232 193036  15828 R   10.6  0.4   0:07.07 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11784 3-koha  20   0  441536 189664  16172 R   10.6  0.4   0:06.04 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11830 3-koha  20   0  439548 187212  15748 R   10.6  0.4   0:05.82 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11831 4-koha  20   0  438620 186344  15748 R   10.6  0.4   0:05.81 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> 11853 4-koha  20   0  437680 185672  16000 R   10.6  0.4   0:05.79 <br>> /usr/share/koha/api/v1/app.pl<br>> <br>> Well, I still have a lot of investigation left to do, but I notice 1 <br>> place that a lot of time taken is here (per worker):<br>> <br>>      my $validator = JSON::Validator::OpenAPI::Mojolicious->new;<br>> <br>>      $validator->load_and_validate_schema(<br>> <br>>          $self->home->rel_file("api/v1/swagger/swagger.json"),<br>> <br>>          {<br>> <br>>            allow_invalid_ref  => 1,<br>> <br>>          }<br>> <br>>        );<br>> <br>>      push @{$self->routes->namespaces}, 'Koha::Plugin';<br>> <br>>      my $spec = $validator->schema->data;<br>> <br>>      $self->plugin(<br>> <br>>          'Koha::REST::Plugin::PluginRoutes' => {<br>> <br>>              spec      => $spec,<br>> <br>>              validator => $validator<br>> <br>>          }<br>> <br>>      );<br>> <br>>      $self->plugin(<br>> <br>>          OpenAPI => {<br>> <br>>              spec  => $spec,<br>> <br>>              route =><br>> $self->routes->under('/api/v1')->to('Auth#under'),<br>> <br>>              allow_invalid_ref =><br>> <br>>                1,    # required by our spec because $ref directly <br>> under<br>> <br>>                      # Paths-, Parameters-, Definitions- & Info-object<br>> <br>>                      # is not allowed by the OpenAPI specification.<br>> <br>>          }<br>> <br>> );<br>> <br>> Anyone have ideas for improving this? Do we have to validate the <br>> schema every time? Can we move the schema validation into a different <br>> module and preload it into Starman using the -M flag so that it’s done<br>> 1 time per Starman master instance rather than 1 time per Starman worker instance?<br>> <br>> I find “/usr/share/koha/api/v1/app.pl” to be the bane of deployments, <br>> as it puts a massive load on a server, when you have multiple Koha <br>> instances on the server.<br>> <br>> David Cook<br>> <br>> Software Engineer<br>> <br>> Prosentient Systems<br>> <br>> Suite 7.03<br>> <br>> 6a Glen St<br>> <br>> Milsons Point NSW 2061<br>> <br>> Australia<br>> <br>> Office: 02 9212 0899<br>> <br>> Online: 02 8005 0595<br>> <br>> <br>> _______________________________________________<br>> Koha-devel mailing list<br>> Koha-devel@lists.koha-community.org<br>> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>> website : https://www.koha-community.org/ git : <br>> https://git.koha-community.org/ bugs : <br>> https://bugs.koha-community.org/<br>> <br><br>--<br>Ere Maijala<br>Kansalliskirjasto / The National Library of Finland _______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org<br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/ git : https://git.koha-community.org/ bugs : https://bugs.koha-community.org/<br><br><br>_______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org<br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/ git : https://git.koha-community.org/ bugs : https://bugs.koha-community.org/<br><br><br>_______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org<br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/ git : https://git.koha-community.org/ bugs : https://bugs.koha-community.org/<br><br><br><br><br>------------------------------<br><br>Subject: Digest Footer<br><br>_______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org<br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/<br>git : https://git.koha-community.org/<br>bugs : https://bugs.koha-community.org/<br><br><br>------------------------------<br><br>End of Koha-devel Digest, Vol 185, Issue 16<br>*******************************************<br></div><br><br>NOTE: You are receiving this mail because, the Requester/Technician wanted you to get notified on this request creation.<br></body></html>