问题
Context:
I implemented a Scheduler
in Scala based on the Mesos Scheduler Interface.
All tasks are perfectly orchestrated.
Expectations:
Now, I would like to be able to monitor the max memory consumed by completed tasks.
I expect to perform this monitoring task inside my implementation of Scheduler.statusUpdate() method, for every task with TASK_FINISHED state.
Question:
In this method, a SchedulerDriver and a Protos.TaskStatus are provided.
So, is there a way to retrieve the max memory used by the corresponding task from a SchedulerDriver and a Protos.TaskStatus?
回答1:
Mesos exposes information about task statistics in slave(1)/monitor/statistics. You need to scrape this endpoint on each agent and aggregate the response to get the maximum value for a given task.
回答2:
Depending on the type of isolation your Mesos agent is configured with, e.g. cgroups/*
or if you are using the Docker containerizer, you might consider running an external service on your agent hosts that collect and aggregate memory and other runtime statistics for you. For instance, you could use a collector daemon such as cadvisor to monitor your tasks and then ship those metrics on to a persistent datastore where they can be queried in a flexible way.
来源:https://stackoverflow.com/questions/46094057/is-there-a-way-to-get-the-max-memory-used-by-a-task-in-mesos