Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Building	High	Scalable	Framework on	
Apache Mesos
RAHUL	KUMAR
TECHNICAL	LEAD,	SIGMOID
“A distributed system is a collection of independent
computers that appears to its
users as a single coherent system.”
A distributed system application works independently
and communication through messages.
q Resource Sharing
q Openness
q Concurrency
q Scalability
q Fault Tolerance
q Transparency
Mesos	Intro
“Apache Mesos abstracts CPU, memory, storage,
and other compute resources away from machines
(physical or virtual), enabling fault-tolerant and
elastic distributed systems to easily be built and
run effectively.”
Building high scalable distributed framework on apache mesos
Building high scalable distributed framework on apache mesos
Building high scalable distributed framework on apache mesos
Software	Projects	Built	on	Mesos
q Aurora is	a	service	scheduler	that	runs	on	top	of	Mesos,	enabling	you	to	run	long-running	
services	that	take	advantage	of	Mesos'	scalability,	fault-tolerance,	and	resource	isolation.
q Marathon is	a	private	PaaS	built	on	Mesos.	It	automatically	handles	hardware	or	software	
failures	and	ensures	that	an	app	is	“always	on”.
q Spark is	a	fast	and	general-purpose	cluster	computing	system	which	makes	parallel	jobs	easy	
to	write.
q Chronos is	a	distributed	job	scheduler	that	supports	complex	job	topologies.	It	can	be	used	as	
a	more	fault-tolerant	replacement	for	Cron.
q ElasticSearch is	a	distributed	search	engine.	Mesos	makes	it	easy	to	run	and	scale.
Create	own	Framework
Why	we	need	to	write	own	framework	:
q Custom	scheduling
q Auto	scaling
q Advanced	Task	Management
Why	Mesos	
q Task	Distribution
q Launching,	Monitoring,	failure	detection
q Resource	isolation
q Container	support
q Messaging	between	Tasks
q Make	State	distributed
Language	Support
Protocol	Buffer
Protocol	buffers	are used	extensively	for	messaging	and	
serialization	inside	Mesos	and	when	developing	Mesos	
frameworks.
- Tasks	are	describe	in	Protocol	buffer	message
- It	helps	it	to	make	language	independent
message	FrameworkInfo{		
required	string	name	=	2;	
optional	FrameworkID id	=	3;		
optional	double	failover_timeout=	4	[default	=	0.0];		
optional	bool	checkpoint	=	5	[default	=	false];		
optional	string	role	=	6	[default	=	"*"];		
optional	string	hostname	=	7;				
optional	string	principal	=	8;		
optional	string	webui_url=	9;		
message	Capability	{				
enum Type	{						
UNKNOWN	=	0;						
REVOCABLE_RESOURCES	=	1;						
TASK_KILLING_STATE	=	2;				
}				optional	Type	type	=	1;		}		repeated	Capability	capabilities	=	10;		optional	Labels	
labels	=	11;}
import	org.apache.mesos.Protos.FrameworkInfo
val framework	=	FrameworkInfo.newBuilder.
setName(“SigApp”).
setUser(”rahul").
setRole("*").
setCheckpoint(false).
setFailoverTimeout(0.0d).
build()
The	Scheduler
The	scheduler	is	the	component	that	interacts	directly	with	the	
leading	Mesos	master
q Launch	tasks	on	the	received	offers
q Handle	status	updates	checking	for	task	failure	and	restart
q State	Persist	and	manage	failovers
Your	framework	scheduler	should	inherit	from	the Scheduler class
scheduler	should	create	a	SchedulerDriver ,	which	will	mediate	
communication	between	your	scheduler	and	the	Mesos	master.
class	SigScheduler()	 extends	Scheduler	{
override	def error(driver:	 SchedulerDriver,	 message:	String)	{}
override	def executorLost(driver:	SchedulerDriver,	 executorId:	ExecutorID,	slaveId:	SlaveID,	status:	Int)	{}
override	def slaveLost(driver:	SchedulerDriver,	 slaveId:	SlaveID)	{}
override	def disconnected(driver:	 SchedulerDriver)	 {}
override	def frameworkMessage(driver:	 SchedulerDriver,	 executorId:	ExecutorID,	slaveId:	SlaveID,	data:	Array[Byte])	{}
override	def statusUpdate(driver:	SchedulerDriver,	 status:	TaskStatus)	{
println(s"received status	update	$status")
}
override	def offerRescinded(driver:	 SchedulerDriver,	 offerId:	OfferID)	{}
override	def resourceOffers(driver:	 SchedulerDriver,	 offers:	java.util.List[Offer])	{
//	code
}
def submitTasks(tasks:	String*)	=	{
this.synchronized {
this._tasks.enqueue(tasks:	_*)
}
}
override	def reregistered(driver:	 SchedulerDriver,	 masterInfo:	MasterInfo)	{}
override	def registered(driver:	 SchedulerDriver,	 frameworkId:	FrameworkID,	masterInfo:	MasterInfo)	{}
Building high scalable distributed framework on apache mesos
The	Executor
q Executer	Executing	tasks	as	requested	by	the	scheduler
q Keeping	the	scheduler	informed	of	the	status	of	those	tasks
q Task	Management
val exec	= new Executor {
override def launchTask(driver: ExecutorDriver, task: TaskInfo)	: Unit ={}
override def killTask(driver: ExecutorDriver, taskId: TaskID)	: Unit ={}
override def shutdown	(driver: ExecutorDriver, taskId: TaskID)	: Unit ={}
}
Mesos	Endpoints
qHTTP	endpoints	available	for	a	given	Mesos	process
http://master.com:5050/files/browse
http://master.com:5050/files/browse/files/debug
http://master.com:5050/files/browse
http://master.com:5050/api/v1/scheduler
http://master.com:5050/health
Thank You
Q/A

More Related Content

Building high scalable distributed framework on apache mesos