Project: baby taschenrechner.de

The just completed project baby taschenrechner.de deals with the issues relating to the development of the own child:

  • How great my child be in x years
  • My child is like in x years
  • Is my child too hard or too thin
  • What dress size is wear it when?

The Web page is to help parents find out, When you need to buy what dress size, the approaching winter/summer home to have the appropriate.

Parents can thus einschätzne, If the child is too thin or too thick for your age/size/weight ratio.

The following technologies were used for the realization:

Symfony 3, Docker, MySQL, PHP, GIT, Google material design, Amazon AWS

The discover performance measure problems and analyze

To analyze latency problems re DIS, can the built-in latency tool by REDIS-cli use, with the order 100 Requests per second on the re DIS be pinged and it can parse the response time.

Consoles BSP:

In the interval i = 10 seconds on localhost tested

redis-cli --latency-history -i 10 -h 127.0.0.1 -p 6379

Output:

min: 0, max: 10, avg: 0.89 (906 samples) -- 10.01 seconds range
min: 0, max: 32, avg: 1.44 (862 samples) -- 10.00 seconds range
min: 0, max: 6, avg: 0.50 (939 samples) -- 10.00 seconds range
min: 0, max: 7, avg: 0.47 (941 samples) -- 10.01 seconds range
min: 0, max: 12, avg: 0.47 (942 samples) -- 10.00 seconds range
min: 0, max: 137, avg: 2.70 (779 samples) -- 10.01 seconds range
min: 0, max: 119, avg: 5.92 (626 samples) -- 10.06 seconds range
min: 0, max: 2389, avg: 7.31 (572 samples) -- 10.00 seconds range
min: 0, max: 14, avg: 0.64 (926 samples) -- 10.00 seconds range
min: 0, max: 9, avg: 0.50 (938 samples) -- 10.01 seconds range
min: 0, max: 16, avg: 0.47 (941 samples) -- 10.01 seconds range
min: 0, max: 21, avg: 0.56 (933 samples) -- 10.01 seconds range
min: 0, max: 23, avg: 0.56 (933 samples) -- 10.01 seconds range
min: 0, max: 150, avg: 1.95 (827 samples) -- 10.01 seconds range
min: 0, max: 131, avg: 4.22 (696 samples) -- 10.01 seconds range
min: 0, max: 131, avg: 7.06 (581 samples) -- 10.01 seconds range
min: 0, max: 4136, avg: 10.33 (488 samples) -- 10.01 seconds range
min: 0, max: 17, avg: 1.15 (886 samples) -- 10.02 seconds range
min: 0, max: 18, avg: 0.88 (906 samples) -- 10.01 seconds range
min: 0, max: 11, avg: 0.61 (928 samples) -- 10.00 seconds range
min: 0, max: 12, avg: 0.55 (936 samples) -- 10.01 seconds range
min: 0, max: 9, avg: 0.51 (937 samples) -- 10.01 seconds range

Here you can see well, that the problems at a distance of 60 Occur seconds. This was because in the case of, that re DIS has persisted is every 60 s on the hard disk. The corresponding option in the redis.conf was:

save 60 1000

and with the option

save ""

may that persist on the hard disk are turned off.

 

But also the option

appendonly yes

had on “no” be set, because there was this on too many writes.

Re DIS replication tips

Beim Betrieb von Redis im Master/Slave Modus muss darauf geachtet werden, that:

1. Master und Slave sind nicht immer auf demselben Stand

Redis uses asynchronous replication. Starting with Redis 2.8, however, slaves will periodically acknowledge the amount of data processed from the replication stream.

D.h. bestimmte Daten müssen vom Master abgefragt werden, as e.g.. Session Daten

2. Safety of replication when master has persistence turned off

In setups where Redis replication is used, it is strongly advised to have persistence turned on in the master, or when this is not possible, for example because of latency concerns, instances should be configured to avoid restarting automatically.

To better understand why masters with persistence turned off configured to auto restart are dangerous, check the following failure mode where data is wiped from the master and all its slaves:

We have a setup with node A acting as master, with persistence turned down, and nodes B and C replicating from node A.
A crashes, however it has some auto-restart system, that restarts the process. However since persistence is turned off, the node restarts with an empty data set.
Nodes B and C will replicate from A, which is empty, so they’ll effectively destroy their copy of the data.

When Redis Sentinel is used for high availability, also turning off persistence on the master, together with auto restart of the process, is dangerous. For example the master can restart fast enough for Sentinel to don’t detect a failure, so that the failure mode described above happens.

Every time data safety is important, and replication is used with master configured without persistence, Auto restart of instances should be disabled.

d.h. the auto restart function should be deactivated for the master, If no immediate persistence on the hard drive is enabled.

3. Master failure

If the master goes down, should the slave agree to a grace period to the master (e.g.. After 10 Minutes).

The discover scripts with Lua programming

To insert a record in a database in re DIS using script, you can save the following script to a file and run:

Script file “redis_insert.LUA”:

 redis.call("select", 1)
 redis.call('set', 'myKey', 'myValue')

Can then run the script using the following command on the console and the data in the record Daniel server is written:

redis-cli --eval redis_insert.lua