abcdesktopio / oc.apps

abcdesktop application dockerfiles, create dedicated Dockerfile for each application
GNU General Public License v2.0
4 stars 2 forks source link

Alert on ram usage and CPU usage #3

Open chintus777 opened 1 year ago

chintus777 commented 1 year ago

Hello Alexandre ,

Thanks for this amazing project. Actually I have created my apps such as chrome and phpstorm , I have added executeclass parameter and running my applications as a pod to achieve ram and cpu restriction .While using this I have achieved the restriction , but user does not get any alert , like in case of chrome tabs get crashed when limit is reached , but how would user know that ram or cpu limit is reached. I think every user should get a warning or alert about ram limit and cpu limit in the VDI itself so that user can manage accordingly . I have gone through the various extensions of chrome , but those tell usage of RAM of the server on which abcdesktop is deployed , not the podapplication of chrome. Can you please suggest me how should I proceed forward about this problem.

Thanks Again Chintu

alexandredevely commented 1 year ago

Hello Chintu,

Thank you for your message and your revelant comment. I like your proposal.

I confirm that user doesn't receive a message if an application is killed by an OOM event.

To do that, we must add the new feature in pyos python source code.

We can catch the kubernetes event in kuberneteswatcher thread and then call notify_user to notify the desktop using orchestrator.notify_user( desktop, method, json_data )

The main branch is the old 2.9 version. Please use the 3.0 branch ( this is the current branch ).

See you Alexandre

alexandredevely commented 1 year ago

Hello Chintu,

I've fixed this issue, let me know if it's ok for you.

The pyos image with OOMKilled embedded notification is

abcdesktopio/oc.pyos:3.0                 40a70c94294d0       387MB

If a pod application gets an OOMKilled event, pyos send a notification to the desktop pod. The desktop pod forwards using an unicast message, the message to the web browser.

For example, inside a executeclass bronze, with low memory limits

  'bronze':{ 
    'nodeSelector':None, 
    'resources':{
      'requests':{'memory':"64Mi",'cpu':"100m"},        
      'limits':  {'memory':"100Mi",'cpu':"500m"}
    } 

I run inside a pod application (konsole based on alpine), the stress-ng command

stress-ng --cpu 8 --io 4 --vm 2 --vm-bytes 128M --fork 4 --timeout 10s
Screenshot 2023-09-01 at 11 23 01

The notification OOMKilled appears on the upper left side, with the name of the application pod.

Screenshot 2023-09-01 at 11 25 48

The pod is also removed in the namespace abcdesktop.

Feel free to share with me some feedback about this issue. Thank you for this feedback and this great idea for a better user experience.

See you

Alexandre

chintus777 commented 1 year ago

Hello Alexandre , Thanks a lot for your solution , it helped me a lot. Actually I am still facing some issues -

  1. I am unable to get alert when CPU consumption is exhausted and RAM is not exhausted
  2. I get alert only sometimes (not getting alert everytime even on using terminal as pod application ) .Terminal get crashed without giving alert.
  3. Alert is not coming on browsers like chrome , firefox , all tabs get crashed when RAM is about to exhaust . The problem is that tabs start to crash even if the RAM limit is not reached , like for eg in bronze class - limit is 900 MB , then tabs will crash when RAM has reach 880-890 MB , but I dont get any warning or OOM notification on desktop. I want the warning before tabs get crashed.

Please implement the alert on CPU consumption as well as it can prevent the system resources.

Please can u look into these .

Thanks Chintu