CF Auto-scaling with an external application


Daniel Mikusa
 

On Fri, Apr 8, 2016 at 2:12 PM, Giovanni Napoli <gio.napoli2(a)gmail.com>
wrote:

@Daniel Mikusa

Thank you for your support. I have few more questions and hope that you
can help me.
If i'll use the library you linked, i'd like to have some suggestions
about the task i have to solve:

- is there a way to collect in some way the data i need in a struct that i
could use for send "the scale command"? I mean, would be great to have a
struct in wich i could have fields like "AppName", "CpuUse", "MemoryUse",
etc. so i cloud just check the App.CpuUse field, for istance, and send a
"cf scale" command to CF to solve resource problems.

- i found this client library for CF, do you think could help my work?
https://github.com/cloudfoundry/cf-java-client/ I'm asking you cause i'll
prefer to use Java, by the way. Is you know, is there a way to have ".jar"
library of this repo so i could use as simple as i can? Also i found this
http://www.ibm.com/developerworks/cloud/library/cl-bluemix-cloudappswithjava/index.html
and a "cloudfoundry-client-lib.jar" online but i don't kwon if could be
good for my problem.
There's two parts to this problem:

1.) You need to get metrics from the platform. I don't think (although
this could have changed, since it's being rewritten at the moment) that
cf-java-client supports this. I know it will allow you to stream logs, but
I'm not sure if you can get metrics as well. If Ben Hale see's this,
perhaps he can comment and confirm.

2.) Once you get metrics, you'd have to manage them and when appropriate
initiate a request to scale the app. You can definitely use the
cf-java-client for this. You can also use it to query information if for
example you have an app guid and need the app name.

Hope that helps!

Thanks,

Dan


Giovanni Napoli
 

Thak you for yuor answer. I gave a look at it but the project is much bigger than what i need for. As i said to Daniel, it should be a very simple application for a minimal study case for PaaS Cloud Foundry. However, still thank you,
Giovanni.


Giovanni Napoli
 

@Daniel Mikusa

Thank you for your support. I have few more questions and hope that you can help me.
If i'll use the library you linked, i'd like to have some suggestions about the task i have to solve:

- is there a way to collect in some way the data i need in a struct that i could use for send "the scale command"? I mean, would be great to have a struct in wich i could have fields like "AppName", "CpuUse", "MemoryUse", etc. so i cloud just check the App.CpuUse field, for istance, and send a "cf scale" command to CF to solve resource problems.

- i found this client library for CF, do you think could help my work? https://github.com/cloudfoundry/cf-java-client/ I'm asking you cause i'll prefer to use Java, by the way. Is you know, is there a way to have ".jar" library of this repo so i could use as simple as i can? Also i found this http://www.ibm.com/developerworks/cloud/library/cl-bluemix-cloudappswithjava/index.html and a "cloudfoundry-client-lib.jar" online but i don't kwon if could be good for my problem.

I would really thank you for your support, and i'm sorry if i made some stupid or specifical question but i really need help. The app i have to develop must be very simple because it is just a mimal study case for the PaaS Cloud Foundry so the easier it is the best would be.
Still thank you,
Giovanni.


Koper, Dies <diesk@...>
 

Hi Giovanni,

You could take a look at this project that IBM recently open sourced, it does memory based scaling, and is written in Java.
https://github.com/cfibmers/open-Autoscaler

Also note that since last week CF has an Incubation Project on App Auto-Scaling. You may find that by the time you finish your thesis, CF has an auto-scaling service.

Regards,
Dies Koper

-----Original Message-----
From: Giovanni Napoli [mailto:gio.napoli2(a)gmail.com]
Sent: Monday, March 28, 2016 4:34 AM
To: cf-dev(a)lists.cloudfoundry.org
Subject: [cf-dev] CF Auto-scaling with an external application

Hi everybody,
i'm studying Cloud Foundry PaaS for my thesis in Computer Science and one of the point i have to develop with this platform is tho project and then develop an external application, written in Java, that could provide to the platform a kind of auto-scaling service that isn't provided for Cloud Foundry by default.
The metrics i would to use for auto-scaling the apps is CPU and RAM usage. I know that using "bosh ssh" into the "runner" job, i can log in into the containers using "wsh" to use a bash terminal into the containers. However, here's my questions:
- is there a way to see, without connecting into the containers, what are the resources used by the apps? Maybe with a "top" or "htop" or whatever command?
- if not, i've seen that in the containers i can't launche this kind of commands to se rosource usage, isn't it?
- is there another solutions, maybe easier, to resolve develop this kind of application?
Any kind of suggestion would be great.
Thank you for your support.


Daniel Mikusa
 

I suspect that you probably want to look at streaming metrics from doppler,
rather than polling metrics from some other sources like inside the
container or an API call.

This project has some sample apps that show connecting a streaming logs and
metrics. I think the latter is probably what you want.

https://github.com/cloudfoundry/noaa
https://github.com/cloudfoundry/noaa#container-metrics

This repo has a little more info too:
https://github.com/cloudfoundry/dropsonde-protocol#message-types

If you do decide that you want to poll instead, this is probably a good API
call for that.

http://apidocs.cloudfoundry.org/233/apps/get_detailed_stats_for_a_started_app.html

You can see all the API call's here: http://apidocs.cloudfoundry.org/

Hope that helps!

Dan


On Sun, Mar 27, 2016 at 1:33 PM, Giovanni Napoli <gio.napoli2(a)gmail.com>
wrote:

Hi everybody,
i'm studying Cloud Foundry PaaS for my thesis in Computer Science and one
of the point i have to develop with this platform is tho project and then
develop an external application, written in Java, that could provide to the
platform a kind of auto-scaling service that isn't provided for Cloud
Foundry by default.
The metrics i would to use for auto-scaling the apps is CPU and RAM usage.
I know that using "bosh ssh" into the "runner" job, i can log in into the
containers using "wsh" to use a bash terminal into the containers. However,
here's my questions:
- is there a way to see, without connecting into the containers, what are
the resources used by the apps? Maybe with a "top" or "htop" or whatever
command?
- if not, i've seen that in the containers i can't launche this kind of
commands to se rosource usage, isn't it?
- is there another solutions, maybe easier, to resolve develop this kind
of application?
Any kind of suggestion would be great.
Thank you for your support.


Giovanni Napoli
 

Hi everybody,
i'm studying Cloud Foundry PaaS for my thesis in Computer Science and one of the point i have to develop with this platform is tho project and then develop an external application, written in Java, that could provide to the platform a kind of auto-scaling service that isn't provided for Cloud Foundry by default.
The metrics i would to use for auto-scaling the apps is CPU and RAM usage. I know that using "bosh ssh" into the "runner" job, i can log in into the containers using "wsh" to use a bash terminal into the containers. However, here's my questions:
- is there a way to see, without connecting into the containers, what are the resources used by the apps? Maybe with a "top" or "htop" or whatever command?
- if not, i've seen that in the containers i can't launche this kind of commands to se rosource usage, isn't it?
- is there another solutions, maybe easier, to resolve develop this kind of application?
Any kind of suggestion would be great.
Thank you for your support.