Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Ping/Ack

PlantUML Macro
@startuml
autonumber

participant ApplicationManager as AM

participant RialtoServerManager as RSM
participant RialtoApplicationSessionServer as RASS
participant RialtoClient as RC

== Periodic health check ==

loop Every [5] seconds
  loop For each Application Session Server

    RSM  --/  RASS:  ping(unique_id)
    RSM  ->   RSM:   SetTimer(healthcheck_frequency[seconds], app_server_id)
    RASS ->   RASS:  ping all internal threads
    RASS --/  RC:    ping(unique_id)

    note left
      This step and next step should be skipped if
      Rialto Client hasn't established an IPC 
      connection - the app session server can ack
      the ping immediately
    end note

    alt Happy case, ping is acknowledged
      RC   --/  RASS:  ack(unique_id)
      RASS --/  RSM:   ack(unique_id)
      opt unique_id in ack matches unique id in ping
        RSM  ->   RSM:   CancelTimer(app_server_id)
        RSM  ->   RSM:   Clear numOfFailedPings
      end
    else Timer fires (Ack not received in time)
      alt App session server is not assigned to an app yet (preloaded)
        RSM  ->   RSM:   Kill app session server & spawn a new one
      else App session server is assigned to an app
        RSM  --/  AM:    appFailed(application_id)
        alt numOfFailedPings >= ServerManagerConfig::numOfFailedPingsBeforeRecovery
            RSM  ->   RSM:   Kill app session server & spawn a new one
        else
            RSM  ->   RSM:   Increment numOfFailedPings
        end
      end
    end
    note across
        App Manager should process the error accordingly, e.g. display an error, restart the app etc.
        Rialto will start recovery action (restart RialtoApplicationSessionServer) if number of failed pings exceeds the limit(ServerManagerConfig::numOfFailedPingsBeforeRecovery).
    end note
  end
end

== Unexpected socket disconnect ==

RASS --/  RSM:   Socket connection lost
note right
  Rialto Server Manager detects connection
  to app session server lost
end note
alt App session server is not assigned to an app yet (preloaded)
  RSM  ->   RSM:   Kill app session server & spawn a new one
else App session server is assigned to an app
  RSM  --/  AM:    appFailed(application_id)
end
@enduml