\documentclass{standalone}

% Diagrams
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,fit,shadows}

\tikzset{
	font={\footnotesize},
	db/.style={draw,cylinder,shape border rotate=90,aspect=.3},
	nl/.style={draw,cloud,cloud puffs=20,cloud puff arc=90,inner sep=0mm,aspect=7,minimum width=15em,minimum height=2.5em,node distance=0.75em},
	nodes={minimum height=1em},
	node distance=1em,
}
\newcommand{\lang}[1]{{\bf\tiny #1}}

\begin{document}
\begin{tikzpicture}
	\node (cwss) {CWSS};

	\node (webp2) [draw,node distance=.3em,below=of cwss,minimum width=10em] {Webpages};
	\node (tasks) [draw,node distance=1.9em,below=of webp2,minimum height=3em,xshift=-2em] {Tasks};
	\node (sdss)  [db,node distance=1.5em,right=of tasks,minimum height=3em] {SDSs};
	\draw[<->](sdss) -- (tasks);

	\node (cloud2) [nl,node distance=8em,below=of cwss] {TCP/iTasks/mTask/(MQTT)};

	\node (tasks3)  [draw,minimum height=.5em,node distance=1.85em,below=of cloud2.south west] {};
	\node (sdss3) [db,node distance=.2em,minimum height=.5em,right=of tasks3] {};
	\node (coll3)  [draw,fit=(sdss3) (tasks3)]{};
	\node (mtask1) [node distance=0mm,left=of coll3]{\lang{mTask}};
	\node (sd3)    [draw,node distance=.75em,below=of coll3,minimum height=1em,minimum width=1.5em,xshift=-1em] {S$_{\ldots}$};
	\node (s13)    [draw,node distance=.2em,left=of sd3,minimum height=1em,minimum width=1.5em] {S$_1$};
	\node (sn3)    [draw,node distance=.2em,right=of sd3,minimum height=1em,minimum width=1.5em] {S$_n$};
	\draw[->](sd3) -- (coll3);
	\draw[->](sn3) -- (coll3);
	\draw[->](s13) -- (coll3);
	\node (coll3a)  [draw,fit=(s13) (sn3) (coll3) (mtask1)] {};

	\node (tasks4)  [draw,minimum height=.5em,node distance=5em,right=of coll3] {};
	\node (sdss4) [db,node distance=.2em,minimum height=.5em,right=of tasks4] {};
	\node (coll4)  [draw,fit=(sdss4) (tasks4)]{};
	\node (mtask2) [node distance=0mm,left=of coll4]{\lang{mTask}};
	\node (sd4)    [draw,node distance=.75em,below=of coll4,minimum height=1em,minimum width=1.5em,xshift=-1em] {S$_{\ldots}$};
	\node (s14)    [draw,node distance=.2em,left=of sd4,minimum height=1em,minimum width=1.5em] {S$_1$};
	\node (sn4)    [draw,node distance=.2em,right=of sd4,minimum height=1em,minimum width=1.5em] {S$_n$};
	\draw[->](sd4) -- (coll4);
	\draw[->](sn4) -- (coll4);
	\draw[->](s14) -- (coll4);
	\node (coll4a)  [draw,fit=(s14) (sn4) (coll4) (mtask2)] {};
	\node (coll4b)  [dashed,draw,node distance=5em,inner ysep=0mm,minimum width=2.7em,right=of coll4a,fit=(coll4a.north) (coll4a.south)] {};

	\draw[<->](tasks) -- (webp2);
	\draw[<->](cloud2) -- (tasks);
	\draw[<->](cloud2) -- (sdss);

	\draw[<->](coll3) -- (cloud2);
	\draw[<->](coll4) -- (cloud2);
	\draw[<->](coll4b.north) -- (cloud2);

	\node (iTasks) [draw,label={[label distance=-1.2em,xshift=-7em]\lang{iTasks}},fit=(webp2) (cloud2) (coll3a) (coll4b)]{};

	\node (nl)[node distance=2.5em,left=of cloud2.west]{Network};
	\node (al)[above=of nl]{Application};
	\node (pl)[below=of nl]{Perception};
	\node (psl)[above=of al,yshift=3em]{Presentation};
	\draw[dashed] ([yshift=-1em,xshift=-2em]nl.south) -- ([xshift=22em,yshift=-1em]nl.south);
	\draw[dashed] ([yshift=.75em,xshift=-2em]nl.north) -- ([xshift=22em,yshift=.75em]nl.north);
	\draw[dashed] ([yshift=4em,xshift=-2em]al.north) -- ([xshift=22em,yshift=4em]al.north);
\end{tikzpicture}
\end{document}
