## 3 System Implementation and Performance Evaluation
### In-Memory Cache and In-Disk Cache  
Ganglia is a scalable distributed monitoring system for high-performance computing systems such as clusters and grids. Nagios provides enterprise-class Open Source information technology monitoring, network monitoring, and server and applications monitoring. Ganglia or Nagios is open-source software and is utilized to monitor server farm resources and obtain related information, but extra hardware resources are required to run the program. This study used SSH to obtain a target server's \"/proc/meminfo\" file. The meminfo is a virtual file in Linux, so it must be read by a cat command. The content of the retrieved meminfo file is shown in Figure 13. By combining MemTotal and MemFree, it could generate the necessary information required by the platform selection. This function was executed once before starting a selection. It was also executed while the user input a stat command in the program interface. A caching mechanism was more necessary in some environments that have many duplicate SQL commands. Every search query will require time and resources. These can be reduced while the cache hits. Therefore, this study designed a high-speed in-memory cache and a large-capacity in-disk cache and the flowchart is shown in Figure 12. This study used Memcached to develop the proposed in-memory cache to yield very highly-efficient data retrieval but it encountered the capacity constraints. In contrast, the idea was to employ an HDFS distributed file system for the in-disk cache because it saved the search results as a text file and uploaded it to the specified folder in HDFS. According to least recently used (LRU) cache-replacement policy, out-of-date data in the memory cache was deleted to maintain the limit size of memory for a cache. The advantage was that you can reduce the amount of memory used, keep only certain \"hot stuff\" stored in a cache, put other less-popular, infrequently accessed data in the database, and did not write a copy to cache until the next same request to the database occurred. Clearly, some new data could be added in the database, but data did not instantly become stored in a cache. The mechanism of the in-memory cache together with the in-disk cache was composed of six algorithms to deal with (1) deleting out-of-date data in the memory cache as shown in Algorithm 2, (2) deleting out-of-date file in the disk cache as shown in Algorithm 3, (2) add up-to-date data to the memory cache as shown in Algorithm 4, (2) add up-to-date data to the disk cache as shown in Algorithm 5, (2) visit current data (hit or miss) in the memory cache as shown in Algorithm 6, and (2) visit current data (hit or miss) in the disk cache as shown in Algorithm 7. First, in order to illustrate the algorithm fluently, we defined the notation it used. Let \(H_{m}\) and \(H_{d}\) denote the memory cache and disk cache, respectively. Moreover, \(H_{mr}\) and \(H_{dr}\) denote the memory cache record and disk cache record, respectively. \(F_{Hm}\) denotes a flag where a zero value will conduct the clearing operation periodically to remove the stale data in the memory cache; otherwise a nonzero value will delete the longest one stored in the memory cache. For disk cache \(F_{Hd}\) denotes a flag that does the similar operation like the preceding \(F_{Hm}\). The function \(\mathrm{T_{s}}\) is used to show the time stamp and the flag \(\mathrm{T_{c}}\) presents the current time. \(H_{m\!fs}\) and \(H_{d\!fs}\) denotes the total of free space in the memory cache and disk cache, respectively. \(D_{i}\) represents the data in the memory cache, and \(D_{i}\)' stands for the specific data. Likewise, \(f_{j}\) represents a data file in the disk cache, and \(f_{j}\)' stands for the specific data file. \(Et\) denotes the longest time period for data stored in the cache.