# 05-25 Refactor RT RSSI Correction

Today I installed phpredis and improved system stability at high upload speeds (10 Hz instead of 5 Hz). For this I installed and configured FastCGI as an alternative to PHPfm and also cleaned up the cache storing mechanism. The client and gateway share the same script, which halved the lines of code on the client side. The backend has no more data duplication in the RDBMS and Cache engine, since BLE server information is not shared or transferred between the two stores. MySQL stores only the mac_address and environment ID to create the relation to environments and the cache stores server measurements of various origins.

Data Type Key TTL Avg. Window Size
List server:mac_addr:client:mac_addr no 0
List server:mac_addr:gateway no 20
List server:mac_addr:calibration yes LLEN

Not dealing with fields for averages in the backend as temporary stores reduces overall complexity of the program, since distinct startup sequences are no longer necessary. Retrieving data from cache has same time complexity (constant time with rolling average) as getting a calculated value in a cashed hashmap. Rolling averages of lists mean that drifts caused by temperature changes in the room and new wireless signal patterns are accounted for in time.

The only downside of my cleanup is that I now need a function that exports cache data as csv. Gnuplot takes this as an input. A formatted string response should be just fine though. Otherwise there were no problems.

Last Updated: 11/23/2020, 9:42:47 PM