# Railway Cloud Resource Management as a Service
## 4 Performance Management of Railway Cloud Resources
### Performance Management Use Cases
The railway cloud resources send to the CRPM service the collected performance data that is processed for the PM job, and it is available for reporting. The update of a PM job may be triggered by the railway cloud operator or autonomously by the RMAO. The PM job update request, which contains measurement selection criteria, is sent to the PM service. The PM service checks the existence of the PM job, checks the permissions of the request, and processes the request parameters. A response for the PM job update request is returned. Subscription to the performance data enables an entity (the railway cloud operator or the RMAO) to receive data that has been collected in the railway cloud. The measurement reports may be used for performance analysis within the RMAO. The reporting of performance data may be in a form of event-based reporting, streaming-based reporting, or file reporting. In event-based reporting, a notification is sent to the subscriber when the thresholds are reached, and may be used for non-real time notifications. For real-time monitoring of KPIs, streaming-based reporting is used to send performance measurement data in a continuous session. File reporting is off-line reporting that uses a file-based notification reporting mechanism. The subscription to notifications must determine the frequency of reporting, the method of delivery, and the encoding scheme used for the payload, a list of PM jobs, and measurements of interest. Figure 9: Communication model of PM job creation and update. Figure 10 shows the communication model of performance measurements notification reporting. A connection between the PM subscription endpoint and the Performance Subscription Manager (PSM) in the CRPM service is established for each event to be reported. The performance data is reported. If the performance data is received successfully, the subscriber sends an acknowledgement, otherwise the subscriber initiates data rejection. Figure 11 shows the communication model of performance measurements file-based reporting. A connection between the PM subscription endpoint and the PSM is established for each file to be reported. It is possible for the file to be uploaded by the PSM, where it pushes data in a file-based format to the CM application. As an alternative, the CM application pulls the performance measurement data after being notified that the file is ready. If the performance data are received successfully, the subscriber sends an acknowledgement, otherwise the subscriber initiates data rejection. Figure 11: Communication model of performance measurements file-based reporting. Figure 10: Communication model of PM event reporting. A PM job may be in an active state when it is currently running, in a suspended state when a request to stop measurements is received, or in a deprecated state when it is deleted after being suspended. A PM job is suspended in order to improve cloud performance because the PM jobs come at the cost of cloud overhead. Figure 12 shows the communication model of PM job suspension. The railway operator may request a PM job suspension, or the RMAO may autonomously initiate it. The PM job suspend request is sent to the CRPM service, which checks whether the PM job exists and evaluates the period for which the PM job has to be suspended (sleeping period), and returns a response in case of success. The requester is informed about the suspended status of the PM job. Exception use cases include not-existent PM job or unexpected conditions. Following the same pattern of communication, the railway cloud operator or the RMAO autonomously may resume a suspended PM job. The railway cloud operator can query, update, or delete a PM job. The update of a PM job occurs when railway cloud resources are updated, added, or deleted, or upon a request by the railway cloud operator or the RMAO.