Bug 17261 - Add memcached configuration info to about.pl
Summary: Add memcached configuration info to about.pl
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on: 11921 17189
Blocks: 17274
  Show dependency treegraph
 
Reported: 2016-09-06 19:23 UTC by Tomás Cohen Arazi
Modified: 2017-06-14 22:15 UTC (History)
12 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 17261: Add memcached configuration info to about.pl (4.14 KB, patch)
2016-09-06 19:36 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 17261: Add memcached configuration info to about.pl (4.20 KB, patch)
2016-09-07 12:59 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17261: (followup) Rebase against 17189 and 11921 (3.40 KB, patch)
2016-09-07 15:47 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 17261: The default memcached namespace is "koha" (1.09 KB, patch)
2016-09-08 09:07 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17261: Memcached may not longer be running (3.12 KB, patch)
2016-09-08 09:07 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17261: Add memcached configuration info to about.pl (4.25 KB, patch)
2016-09-13 14:21 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 17261: (followup) Rebase against 17189 and 11921 (3.46 KB, patch)
2016-09-13 14:21 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 17261: The default memcached namespace is "koha" (1.15 KB, patch)
2016-09-13 14:21 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 17261: Memcached may not longer be running (3.19 KB, patch)
2016-09-13 14:22 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 17261: (followup) Mention the need to start memcached before plack (2.05 KB, patch)
2016-09-13 14:53 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
[PASSED QA] Bug 17261: Add memcached configuration info to about.pl (4.32 KB, patch)
2016-11-01 16:17 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 17261: (followup) Rebase against 17189 and 11921 (3.53 KB, patch)
2016-11-01 16:17 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 17261: The default memcached namespace is "koha" (1.22 KB, patch)
2016-11-01 16:17 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 17261: Memcached may not longer be running (3.26 KB, patch)
2016-11-01 16:17 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 17261: (followup) Mention the need to start memcached before plack (2.43 KB, patch)
2016-11-01 16:17 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2016-09-06 19:23:49 UTC
It would be helpful in several situations to have that information at hand, as we do for other stuff (zebra, apache, plack, etc).
Comment 1 Tomás Cohen Arazi 2016-09-06 19:36:00 UTC Comment hidden (obsolete)
Comment 2 Nick Clemens 2016-09-07 12:59:34 UTC Comment hidden (obsolete)
Comment 3 Tomás Cohen Arazi 2016-09-07 15:47:58 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2016-09-08 09:07:53 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2016-09-08 09:07:56 UTC Comment hidden (obsolete)
Comment 6 Jonathan Druart 2016-09-13 08:22:29 UTC
Can I get a signoff on the 2 last patches?
Comment 7 Tomás Cohen Arazi 2016-09-13 14:21:00 UTC
Created attachment 55535 [details] [review]
Bug 17261: Add memcached configuration info to about.pl

This patch adds a row in the About > System information tab, showing
the current configuration for memcached.

To test:
- Apply this patch, have memcached configured for the current instance (this is the
  default in kohadevbox)
- Make sure you have the memcached server running:
  $ sudo service memcached start
- Open the about page in the browser
=> SUCCESS: You get something like:
  Memcached:    Servers: 127.0.0.1:11211 | Namespace: koha_kohadev | Status: running
- Stop the memcached server:
  $ sudo service memcached stop
- Reload the about page
=> SUCCESS: You get something like
  Memcached:    Servers: 127.0.0.1:11211 | Namespace: koha_kohadev | Status: not running
- Set both MEMCACHED_* variables in the apache config for intranet the empty string:
  $ sudo vim /etc/apache2/sites-enabled/kohadev.conf
..
   SetEnv MEMCACHED_SERVERS ""
    #"127.0.0.1:11211"
   SetEnv MEMCACHED_NAMESPACE ""
    #"koha_kohadev"
..
- Restart apache:
  $ sudo service apache2 restart
- Reload the about page
=> SUCCESS: You get something like:
  Memcached:  Servers: undefined| Namespace: undefined | Status: unknown
- Sign off :-D

Sponsored-by: ByWater Solutions

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 8 Tomás Cohen Arazi 2016-09-13 14:21:28 UTC
Created attachment 55536 [details] [review]
Bug 17261: (followup) Rebase against 17189 and 11921

This patch adjusts the original one so it works on top of 17189
and 11921. It adds an 'Effective caching method' text which can
be useful, when memcached is not available.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 9 Tomás Cohen Arazi 2016-09-13 14:21:44 UTC
Created attachment 55537 [details] [review]
Bug 17261: The default memcached namespace is "koha"

If no namespace is defined in ENV or the config, "koha" is used as the
default memcached namespace (See Koha::Cache->new)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 10 Tomás Cohen Arazi 2016-09-13 14:22:01 UTC
Created attachment 55538 [details] [review]
Bug 17261: Memcached may not longer be running

If plack is started with memcached, memcached will be considered as
running, even if it has been stopped (or crashed).
This case should be highlighted on the about page.
Note that I am not sure about the consequences of this specific case!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 11 Tomás Cohen Arazi 2016-09-13 14:53:20 UTC
Created attachment 55542 [details] [review]
Bug 17261: (followup) Mention the need to start memcached before plack

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 12 Jonathan Druart 2016-09-14 11:56:11 UTC
(In reply to Tomás Cohen Arazi from comment #11)
> Created attachment 55542 [details] [review] [review]
> Bug 17261: (followup) Mention the need to start memcached before plack
> 
> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

I cannot explain what's happening but actually it seems that if you restart memcached without plack, the first request will display "not running", but the second one will display "running".
And it seems to work correctly (i.e. the connection to memcached is restored).
Comment 13 Jacek Ablewicz 2016-09-14 12:27:00 UTC
(In reply to Tomás Cohen Arazi from comment #11)
> Created attachment 55542 [details] [review] [review]
> Bug 17261: (followup) Mention the need to start memcached before plack

It seems that in debian packaged versions, koha script (which brings up starman/plack and now rebuild_zebra.pl in daemon mode too) in /etc/rc* is started before memcached and before mysql..
Comment 14 Jacek Ablewicz 2016-09-14 14:20:32 UTC
On top of Bug 11921, there is a possibility that for a given process or plack worker, "Effective caching method" may be in fact sometimes mixed / various (e.g. memcached used for syspref caching and Cache::Memory for everything else, or vice versa).
Comment 15 Jonathan Druart 2016-10-18 16:04:13 UTC
Jacek, do you think 17261 and 17274 are correct or do they need to be reworked?

I think we are cover all the cases and that should work correctly most of the time.
However it will be bad to display wrong informations...
Comment 16 Katrin Fischer 2016-10-26 23:50:50 UTC
Not sure about the last comment - is this ready for QA?
Comment 17 Tomás Cohen Arazi 2016-10-26 23:56:43 UTC
(In reply to Katrin Fischer from comment #16)
> Not sure about the last comment - is this ready for QA?

I think is ready for QA. The problem is that it is possible to construct a scenario in which each Plack worker has a different memcached situation. It will only mean something is not really ok, and make people look at it. Otherwise, users will have the memcached information which is also handy.
Comment 18 Jacek Ablewicz 2016-10-27 08:01:38 UTC
(In reply to Tomás Cohen Arazi from comment #17)
> (In reply to Katrin Fischer from comment #16)
> > Not sure about the last comment - is this ready for QA?
> 
> I think is ready for QA. The problem is that it is possible to construct a
> scenario in which each Plack worker has a different memcached situation.

Or the scenario when the single plack worker has one of eight different hypothetically possible memcached & Cache::Memory combinations / situations ;)
Comment 19 Jacek Ablewicz 2016-10-27 08:06:15 UTC
(In reply to Tomás Cohen Arazi from comment #17)

> I think is ready for QA.

+1

IMO this patchset is fine as it is, and would be a valuable addition even if it doesn't fully cover some very unusual (and almost purely theoretical) situations.
Comment 20 Jacek Ablewicz 2016-10-27 08:31:15 UTC
(In reply to Jonathan Druart from comment #15)

> I think we are cover all the cases and that should work correctly most of
> the time.

+1, if we want to minimize the possibilities of mixed/inconsistent cache initializations, it would be better to do it differently / in different places, eg.:

- improve memcache initialization procedures (currently each one of 3 cache instances has it's own connection to the memcache server = 3 separate inits when plack worker gets created, each init can have different result)

- at some time, maybe get rid of Cache::Memory entirely? - sooner or later working memcached setup should IMO became a hard requirement (especially under plack)
Comment 21 Katrin Fischer 2016-11-01 15:32:05 UTC
This works for me nicely, until I activate Plack.

Testing in a kohadevbox, started testing without Plack, test plan worked.
Then I started Plack:
sudo koha-plack --enable kohadev
sudo service apache2 restart
sudo koha-plack --start kohadev

About page:
Servers: undefined| Namespace: koha | Status: unknown | Effective caching method: Cache::Memory 

I tried restarting memcached:
sudo service memcached restart

No change - is this to be expected?
Comment 22 Jonathan Druart 2016-11-01 15:49:35 UTC
Everything looks ok for me.

Without memcached and plack configured/set:

 Servers: undefined| Namespace: koha | Status: unknown | Effective caching method: Cache::Memory 

% Edit $KOHA_CONF and add memcached_servers
% sudo service memcached start

 Servers: localhost:11211 | Namespace: koha | Status: running.

% sudo koha-plack --enable kohadev
% sudo koha-plack --start kohadev
% sudo service apache2 restart

 Servers: localhost:11211 | Namespace: koha | Status: running.

% sudo service memcached stop

 Servers: localhost:11211 | Namespace: koha | Status: not running. Remember memcached needs to be started before Plack. 

% sudo service memcached start

 Servers: localhost:11211 | Namespace: koha | Status: not running. Remember memcached needs to be started before Plack. 

% sudo koha-plack --restart kohadev

 Servers: localhost:11211 | Namespace: koha | Status: running.
Comment 23 Katrin Fischer 2016-11-01 16:17:04 UTC
Created attachment 57049 [details] [review]
[PASSED QA] Bug 17261: Add memcached configuration info to about.pl

This patch adds a row in the About > System information tab, showing
the current configuration for memcached.

To test:
- Apply this patch, have memcached configured for the current instance (this is the
  default in kohadevbox)
- Make sure you have the memcached server running:
  $ sudo service memcached start
- Open the about page in the browser
=> SUCCESS: You get something like:
  Memcached:    Servers: 127.0.0.1:11211 | Namespace: koha_kohadev | Status: running
- Stop the memcached server:
  $ sudo service memcached stop
- Reload the about page
=> SUCCESS: You get something like
  Memcached:    Servers: 127.0.0.1:11211 | Namespace: koha_kohadev | Status: not running
- Set both MEMCACHED_* variables in the apache config for intranet the empty string:
  $ sudo vim /etc/apache2/sites-enabled/kohadev.conf
..
   SetEnv MEMCACHED_SERVERS ""
    #"127.0.0.1:11211"
   SetEnv MEMCACHED_NAMESPACE ""
    #"koha_kohadev"
..
- Restart apache:
  $ sudo service apache2 restart
- Reload the about page
=> SUCCESS: You get something like:
  Memcached:  Servers: undefined| Namespace: undefined | Status: unknown
- Sign off :-D

Sponsored-by: ByWater Solutions

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer  <katrin.fischer@bsz-bw.de>
Comment 24 Katrin Fischer 2016-11-01 16:17:08 UTC
Created attachment 57050 [details] [review]
[PASSED QA] Bug 17261: (followup) Rebase against 17189 and 11921

This patch adjusts the original one so it works on top of 17189
and 11921. It adds an 'Effective caching method' text which can
be useful, when memcached is not available.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer  <katrin.fischer@bsz-bw.de>
Comment 25 Katrin Fischer 2016-11-01 16:17:12 UTC
Created attachment 57051 [details] [review]
[PASSED QA] Bug 17261: The default memcached namespace is "koha"

If no namespace is defined in ENV or the config, "koha" is used as the
default memcached namespace (See Koha::Cache->new)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer  <katrin.fischer@bsz-bw.de>
Comment 26 Katrin Fischer 2016-11-01 16:17:16 UTC
Created attachment 57052 [details] [review]
[PASSED QA] Bug 17261: Memcached may not longer be running

If plack is started with memcached, memcached will be considered as
running, even if it has been stopped (or crashed).
This case should be highlighted on the about page.
Note that I am not sure about the consequences of this specific case!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer  <katrin.fischer@bsz-bw.de>
Comment 27 Katrin Fischer 2016-11-01 16:17:19 UTC
Created attachment 57053 [details] [review]
[PASSED QA] Bug 17261: (followup) Mention the need to start memcached before plack

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Katrin Fischer  <katrin.fischer@bsz-bw.de>
Comment 28 Kyle M Hall 2016-11-02 10:55:38 UTC
Pushed to master for 16.11, thanks Tomas, Jonathan!
Comment 29 Mason James 2016-11-30 08:16:35 UTC
enhancement, passing for 16.05