Advertisement
Guest User

Untitled

a guest
Apr 10th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.18 KB | None | 0 0
  1.  
  2. %% bare_conf.tex
  3. %% V1.4b
  4. %% 2015/08/26
  5. %% by Michael Shell
  6. %% See:
  7. %% http://www.michaelshell.org/
  8. %% for current contact information.
  9. %%
  10. %% This is a skeleton file demonstrating the use of IEEEtran.cls
  11. %% (requires IEEEtran.cls version 1.8b or later) with an IEEE
  12. %% conference paper.
  13. %%
  14. %% Support sites:
  15. %% http://www.michaelshell.org/tex/ieeetran/
  16. %% http://www.ctan.org/pkg/ieeetran
  17. %% and
  18. %% http://www.ieee.org/
  19.  
  20. %%*************************************************************************
  21. %% Legal Notice:
  22. %% This code is offered as-is without any warranty either expressed or
  23. %% implied; without even the implied warranty of MERCHANTABILITY or
  24. %% FITNESS FOR A PARTICULAR PURPOSE!
  25. %% User assumes all risk.
  26. %% In no event shall the IEEE or any contributor to this code be liable for
  27. %% any damages or losses, including, but not limited to, incidental,
  28. %% consequential, or any other damages, resulting from the use or misuse
  29. %% of any information contained here.
  30. %%
  31. %% All comments are the opinions of their respective authors and are not
  32. %% necessarily endorsed by the IEEE.
  33. %%
  34. %% This work is distributed under the LaTeX Project Public License (LPPL)
  35. %% ( http://www.latex-project.org/ ) version 1.3, and may be freely used,
  36. %% distributed and modified. A copy of the LPPL, version 1.3, is included
  37. %% in the base LaTeX documentation of all distributions of LaTeX released
  38. %% 2003/12/01 or later.
  39. %% Retain all contribution notices and credits.
  40. %% ** Modified files should be clearly indicated as such, including **
  41. %% ** renaming them and changing author support contact information. **
  42. %%*************************************************************************
  43.  
  44.  
  45. % *** Authors should verify (and, if needed, correct) their LaTeX system ***
  46. % *** with the testflow diagnostic prior to trusting their LaTeX platform ***
  47. % *** with production work. The IEEE's font choices and paper sizes can ***
  48. % *** trigger bugs that do not appear when using other class files. *** ***
  49. % The testflow support page is at:
  50. % http://www.michaelshell.org/tex/testflow/
  51.  
  52.  
  53.  
  54. \documentclass[conference]{IEEEtran}
  55. % Some Computer Society conferences also require the compsoc mode option,
  56. % but others use the standard conference format.
  57. %
  58. % If IEEEtran.cls has not been installed into the LaTeX system files,
  59. % manually specify the path to it like:
  60. % \documentclass[conference]{../sty/IEEEtran}
  61.  
  62.  
  63.  
  64.  
  65.  
  66. % Some very useful LaTeX packages include:
  67. % (uncomment the ones you want to load)
  68.  
  69.  
  70. % *** MISC UTILITY PACKAGES ***
  71. %
  72. %\usepackage{ifpdf}
  73. % Heiko Oberdiek's ifpdf.sty is very useful if you need conditional
  74. % compilation based on whether the output is pdf or dvi.
  75. % usage:
  76. % \ifpdf
  77. % % pdf code
  78. % \else
  79. % % dvi code
  80. % \fi
  81. % The latest version of ifpdf.sty can be obtained from:
  82. % http://www.ctan.org/pkg/ifpdf
  83. % Also, note that IEEEtran.cls V1.7 and later provides a builtin
  84. % \ifCLASSINFOpdf conditional that works the same way.
  85. % When switching from latex to pdflatex and vice-versa, the compiler may
  86. % have to be run twice to clear warning/error messages.
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. % *** CITATION PACKAGES ***
  94. %
  95. %\usepackage{cite}
  96. % cite.sty was written by Donald Arseneau
  97. % V1.6 and later of IEEEtran pre-defines the format of the cite.sty package
  98. % \cite{} output to follow that of the IEEE. Loading the cite package will
  99. % result in citation numbers being automatically sorted and properly
  100. % "compressed/ranged". e.g., [1], [9], [2], [7], [5], [6] without using
  101. % cite.sty will become [1], [2], [5]--[7], [9] using cite.sty. cite.sty's
  102. % \cite will automatically add leading space, if needed. Use cite.sty's
  103. % noadjust option (cite.sty V3.8 and later) if you want to turn this off
  104. % such as if a citation ever needs to be enclosed in parenthesis.
  105. % cite.sty is already installed on most LaTeX systems. Be sure and use
  106. % version 5.0 (2009-03-20) and later if using hyperref.sty.
  107. % The latest version can be obtained at:
  108. % http://www.ctan.org/pkg/cite
  109. % The documentation is contained in the cite.sty file itself.
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116. % *** GRAPHICS RELATED PACKAGES ***
  117. %
  118. \ifCLASSINFOpdf
  119. \usepackage[pdftex]{graphicx}
  120. % declare the path(s) where your graphic files are
  121. % \graphicspath{{../pdf/}{../jpeg/}}
  122. % and their extensions so you won't have to specify these with
  123. % every instance of \includegraphics
  124. % \DeclareGraphicsExtensions{.pdf,.jpeg,.png}
  125. \else
  126. % or other class option (dvipsone, dvipdf, if not using dvips). graphicx
  127. % will default to the driver specified in the system graphics.cfg if no
  128. % driver is specified.
  129. % \usepackage[dvips]{graphicx}
  130. % declare the path(s) where your graphic files are
  131. % \graphicspath{{../eps/}}
  132. % and their extensions so you won't have to specify these with
  133. % every instance of \includegraphics
  134. % \DeclareGraphicsExtensions{.eps}
  135. \fi
  136. % graphicx was written by David Carlisle and Sebastian Rahtz. It is
  137. % required if you want graphics, photos, etc. graphicx.sty is already
  138. % installed on most LaTeX systems. The latest version and documentation
  139. % can be obtained at:
  140. % http://www.ctan.org/pkg/graphicx
  141. % Another good source of documentation is "Using Imported Graphics in
  142. % LaTeX2e" by Keith Reckdahl which can be found at:
  143. % http://www.ctan.org/pkg/epslatex
  144. %
  145. % latex, and pdflatex in dvi mode, support graphics in encapsulated
  146. % postscript (.eps) format. pdflatex in pdf mode supports graphics
  147. % in .pdf, .jpeg, .png and .mps (metapost) formats. Users should ensure
  148. % that all non-photo figures use a vector format (.eps, .pdf, .mps) and
  149. % not a bitmapped formats (.jpeg, .png). The IEEE frowns on bitmapped formats
  150. % which can result in "jaggedy"/blurry rendering of lines and letters as
  151. % well as large increases in file sizes.
  152. %
  153. % You can find documentation about the pdfTeX application at:
  154. % http://www.tug.org/applications/pdftex
  155.  
  156.  
  157.  
  158.  
  159.  
  160. % *** MATH PACKAGES ***
  161. %
  162. %\usepackage{amsmath}
  163. % A popular package from the American Mathematical Society that provides
  164. % many useful and powerful commands for dealing with mathematics.
  165. %
  166. % Note that the amsmath package sets \interdisplaylinepenalty to 10000
  167. % thus preventing page breaks from occurring within multiline equations. Use:
  168. %\interdisplaylinepenalty=2500
  169. % after loading amsmath to restore such page breaks as IEEEtran.cls normally
  170. % does. amsmath.sty is already installed on most LaTeX systems. The latest
  171. % version and documentation can be obtained at:
  172. % http://www.ctan.org/pkg/amsmath
  173.  
  174.  
  175.  
  176.  
  177.  
  178. % *** SPECIALIZED LIST PACKAGES ***
  179. %
  180. %\usepackage{algorithmic}
  181. % algorithmic.sty was written by Peter Williams and Rogerio Brito.
  182. % This package provides an algorithmic environment fo describing algorithms.
  183. % You can use the algorithmic environment in-text or within a figure
  184. % environment to provide for a floating algorithm. Do NOT use the algorithm
  185. % floating environment provided by algorithm.sty (by the same authors) or
  186. % algorithm2e.sty (by Christophe Fiorio) as the IEEE does not use dedicated
  187. % algorithm float types and packages that provide these will not provide
  188. % correct IEEE style captions. The latest version and documentation of
  189. % algorithmic.sty can be obtained at:
  190. % http://www.ctan.org/pkg/algorithms
  191. % Also of interest may be the (relatively newer and more customizable)
  192. % algorithmicx.sty package by Szasz Janos:
  193. % http://www.ctan.org/pkg/algorithmicx
  194.  
  195.  
  196.  
  197.  
  198. % *** ALIGNMENT PACKAGES ***
  199. %
  200. %\usepackage{array}
  201. % Frank Mittelbach's and David Carlisle's array.sty patches and improves
  202. % the standard LaTeX2e array and tabular environments to provide better
  203. % appearance and additional user controls. As the default LaTeX2e table
  204. % generation code is lacking to the point of almost being broken with
  205. % respect to the quality of the end results, all users are strongly
  206. % advised to use an enhanced (at the very least that provided by array.sty)
  207. % set of table tools. array.sty is already installed on most systems. The
  208. % latest version and documentation can be obtained at:
  209. % http://www.ctan.org/pkg/array
  210.  
  211.  
  212. % IEEEtran contains the IEEEeqnarray family of commands that can be used to
  213. % generate multiline equations as well as matrices, tables, etc., of high
  214. % quality.
  215.  
  216.  
  217.  
  218.  
  219. % *** SUBFIGURE PACKAGES ***
  220. %\ifCLASSOPTIONcompsoc
  221. % \usepackage[caption=false,font=normalsize,labelfont=sf,textfont=sf]{subfig}
  222. %\else
  223. % \usepackage[caption=false,font=footnotesize]{subfig}
  224. %\fi
  225. % subfig.sty, written by Steven Douglas Cochran, is the modern replacement
  226. % for subfigure.sty, the latter of which is no longer maintained and is
  227. % incompatible with some LaTeX packages including fixltx2e. However,
  228. % subfig.sty requires and automatically loads Axel Sommerfeldt's caption.sty
  229. % which will override IEEEtran.cls' handling of captions and this will result
  230. % in non-IEEE style figure/table captions. To prevent this problem, be sure
  231. % and invoke subfig.sty's "caption=false" package option (available since
  232. % subfig.sty version 1.3, 2005/06/28) as this is will preserve IEEEtran.cls
  233. % handling of captions.
  234. % Note that the Computer Society format requires a larger sans serif font
  235. % than the serif footnote size font used in traditional IEEE formatting
  236. % and thus the need to invoke different subfig.sty package options depending
  237. % on whether compsoc mode has been enabled.
  238. %
  239. % The latest version and documentation of subfig.sty can be obtained at:
  240. % http://www.ctan.org/pkg/subfig
  241.  
  242.  
  243.  
  244.  
  245. % *** FLOAT PACKAGES ***
  246. %
  247. %\usepackage{fixltx2e}
  248. % fixltx2e, the successor to the earlier fix2col.sty, was written by
  249. % Frank Mittelbach and David Carlisle. This package corrects a few problems
  250. % in the LaTeX2e kernel, the most notable of which is that in current
  251. % LaTeX2e releases, the ordering of single and double column floats is not
  252. % guaranteed to be preserved. Thus, an unpatched LaTeX2e can allow a
  253. % single column figure to be placed prior to an earlier double column
  254. % figure.
  255. % Be aware that LaTeX2e kernels dated 2015 and later have fixltx2e.sty's
  256. % corrections already built into the system in which case a warning will
  257. % be issued if an attempt is made to load fixltx2e.sty as it is no longer
  258. % needed.
  259. % The latest version and documentation can be found at:
  260. % http://www.ctan.org/pkg/fixltx2e
  261.  
  262.  
  263. %\usepackage{stfloats}
  264. % stfloats.sty was written by Sigitas Tolusis. This package gives LaTeX2e
  265. % the ability to do double column floats at the bottom of the page as well
  266. % as the top. (e.g., "\begin{figure*}[!b]" is not normally possible in
  267. % LaTeX2e). It also provides a command:
  268. %\fnbelowfloat
  269. % to enable the placement of footnotes below bottom floats (the standard
  270. % LaTeX2e kernel puts them above bottom floats). This is an invasive package
  271. % which rewrites many portions of the LaTeX2e float routines. It may not work
  272. % with other packages that modify the LaTeX2e float routines. The latest
  273. % version and documentation can be obtained at:
  274. % http://www.ctan.org/pkg/stfloats
  275. % Do not use the stfloats baselinefloat ability as the IEEE does not allow
  276. % \baselineskip to stretch. Authors submitting work to the IEEE should note
  277. % that the IEEE rarely uses double column equations and that authors should try
  278. % to avoid such use. Do not be tempted to use the cuted.sty or midfloat.sty
  279. % packages (also by Sigitas Tolusis) as the IEEE does not format its papers in
  280. % such ways.
  281. % Do not attempt to use stfloats with fixltx2e as they are incompatible.
  282. % Instead, use Morten Hogholm'a dblfloatfix which combines the features
  283. % of both fixltx2e and stfloats:
  284. %
  285. % \usepackage{dblfloatfix}
  286. % The latest version can be found at:
  287. % http://www.ctan.org/pkg/dblfloatfix
  288.  
  289.  
  290.  
  291.  
  292. % *** PDF, URL AND HYPERLINK PACKAGES ***
  293. %
  294. \usepackage{url}
  295. % url.sty was written by Donald Arseneau. It provides better support for
  296. % handling and breaking URLs. url.sty is already installed on most LaTeX
  297. % systems. The latest version and documentation can be obtained at:
  298. % http://www.ctan.org/pkg/url
  299. % Basically, \url{my_url_here}.
  300.  
  301.  
  302.  
  303.  
  304. % *** Do not adjust lengths that control margins, column widths, etc. ***
  305. % *** Do not use packages that alter fonts (such as pslatex). ***
  306. % There should be no need to do such things with IEEEtran.cls V1.6 and later.
  307. % (Unless specifically asked to do so by the journal or conference you plan
  308. % to submit to, of course. )
  309.  
  310.  
  311. % correct bad hyphenation here
  312. \hyphenation{op-tical net-works semi-conduc-tor}
  313.  
  314.  
  315. \begin{document}
  316. %
  317. % paper title
  318. % Titles are generally capitalized except for words such as a, an, and, as,
  319. % at, but, by, for, in, nor, of, on, or, the, to and up, which are usually
  320. % not capitalized unless they are the first or last word of the title.
  321. % Linebreaks \\ can be used within to get better formatting as desired.
  322. % Do not put math or special symbols in the title.
  323. \title{Node.js characteristics and comparison with other \\backend technologies}
  324.  
  325.  
  326. % author names and affiliations
  327. % use a multiple column layout for up to three different
  328. % affiliations
  329. \author{\IEEEauthorblockN{Dušan Milunović, dusanmilunovic17@gmail.com\\
  330. Nenad Mišić, nenad.misic997@gmail.com\\
  331. Nikola Nemeš, nikolanemzi@gmail.com}
  332. \IEEEauthorblockA{Faculty of Technical Sciences\\
  333. University of Novi Sad}}
  334.  
  335. % conference papers do not typically use \thanks and this command
  336. % is locked out in conference mode. If really needed, such as for
  337. % the acknowledgment of grants, issue a \IEEEoverridecommandlockouts
  338. % after \documentclass
  339.  
  340. % for over three affiliations, or if they all won't fit within the width
  341. % of the page, use this alternative format:
  342. %
  343. %\author{\IEEEauthorblockN{Michael Shell\IEEEauthorrefmark{1},
  344. %Homer Simpson\IEEEauthorrefmark{2},
  345. %James Kirk\IEEEauthorrefmark{3},
  346. %Montgomery Scott\IEEEauthorrefmark{3} and
  347. %Eldon Tyrell\IEEEauthorrefmark{4}}
  348. %\IEEEauthorblockA{\IEEEauthorrefmark{1}School of Electrical and Computer Engineering\\
  349. %Georgia Institute of Technology,
  350. %Atlanta, Georgia 30332--0250\\ Email: see http://www.michaelshell.org/contact.html}
  351. %\IEEEauthorblockA{\IEEEauthorrefmark{2}Twentieth Century Fox, Springfield, USA\\
  352. %Email: homer@thesimpsons.com}
  353. %\IEEEauthorblockA{\IEEEauthorrefmark{3}Starfleet Academy, San Francisco, California 96678-2391\\
  354. %Telephone: (800) 555--1212, Fax: (888) 555--1212}
  355. %\IEEEauthorblockA{\IEEEauthorrefmark{4}Tyrell Inc., 123 Replicant Street, Los Angeles, California 90210--4321}}
  356.  
  357.  
  358.  
  359.  
  360. % use for special paper notices
  361. %\IEEEspecialpapernotice{(Invited Paper)}
  362.  
  363.  
  364.  
  365.  
  366. % make the title area
  367. \maketitle
  368.  
  369. % As a general rule, do not put math, special symbols or citations
  370. % in the abstract
  371. \begin{abstract}
  372. The abstract goes here.
  373.  
  374. Keywords --- node.js; performance; backend technologies;
  375. \end{abstract}
  376.  
  377.  
  378.  
  379.  
  380.  
  381. % For peer review papers, you can put extra information on the cover
  382. % page as needed:
  383. % \ifCLASSOPTIONpeerreview
  384. % \begin{center} \bfseries EDICS Category: 3-BBND \end{center}
  385. % \fi
  386. %
  387. % For peerreview papers, this IEEEtran command inserts a page break and
  388. % creates the second title. It will be ignored for other modes.
  389. \IEEEpeerreviewmaketitle
  390.  
  391.  
  392.  
  393. \section{Introduction}
  394. % no \IEEEPARstart
  395. In this paper, we will compare Node.js to other popular backend technologies in terms of performance and scalability by analyzing different aspects of their implementations. We will further explain the key differences which allow Node.js to outperform its alternatives in specific situations. We will also address situations in which Node.js falls behind.\\ This paper can help people make a better decision which technology to use according to the project needs. In addition, it highlights the subtle differences which are often overlooked by developers and shows them what are the tasks in which this technology excels, but also presents critical situations where it is not the best choice.\\
  396.  
  397. %\hfill mds
  398. %\hfill August 26, 2015
  399. \section{Introduction to node.js}
  400. In this part we will go over a brief historical summary of
  401. Node.js and describe the basic principles, including:
  402. \begin{itemize}
  403. \item Asynchronous function handling
  404. \item Event pooling
  405. \item Single-threaded pattern
  406. \end{itemize}
  407. \subsection{Historical overview}
  408. Here we will describe the idea and process of turning a
  409. frontend language into a fully-functional and high-performing
  410. server runtime environment.\\
  411.  
  412. Node.js was developed by Ryan Dahl in 2009. It was built on Google's V8 JavaScript engine, which was formerly only used for front end applications in Google Chrome and couple of other internet browsers. It was initially only supported on Linux and Mac OS systems. The reason for the development of node.js was that the most popular web servers(such as Apache) had certain limitations. The biggest one was handling handling a large number of concurrent requests(up to 10000 and more). \cite{presentation:dahl}
  413.  
  414. The main idea was to make a server side technology that could scale better and serve a larger number of clients. This was accomplished by using asynchronous function calls instead of long running synchronous function calls. This enables the server to make better use of processor time, but it also comes with its challenges when writing code.
  415.  
  416. A node package manager(npm) was introduced in 2010, which has allowed the developers to easily distribute modules. This has led to a far greater speed of development of node.js projects.\cite{npm}
  417.  
  418. \subsection{Basics of Node.js}
  419. In this subsection we will go over the basic principles which set Node
  420. apart from other backend technologies. \\
  421.  
  422. %TODO: mozda dodaj za runtime environment
  423. \subsubsection{Asynchronous function handling}
  424. Node.js uses asynchronous function handling for I/O functions. What this means is that when an I/O function is called, the calling thread(the main thread of node.js) will not wait for it to finish execution. Instead it can continue to run the rest of the program that is not dependent on the result of the I/O operation. The code that is dependent on the result of the I/O operation will be placed in a callback function. This function will be called once the I/O operation is finished. The execution of the asynchronous method is usually delegated to the system kernel or a database program.
  425. \begin{figure}[ht]
  426. \centering
  427. \includegraphics[width=0.9\linewidth]{asynchronous}
  428. \caption{Asynchronous function calls}
  429. \label{fig:asynchronous}
  430. \end{figure}
  431.  
  432. \subsubsection{Event pooling}
  433. \begin{figure}[ht]
  434. \centering
  435. \includegraphics[width=0.9\linewidth]{eventpool}
  436. \caption{Event loop}
  437. \label{fig:eventpool}
  438. \end{figure}
  439. The event loop allows Node.js to perform asynchronous I/O operations. \cite{eventloop:nodejs} It goes through a couple of phases. Each phase contains a queue of callbacks. Each phase also has a set of actions specific to it.\\
  440.  
  441.  
  442. Figure \ref{fig:eventpool} shows a diagram of the node js event loop. Every rectangle on the figure represents one phase of the event loop. In the next set of subsections, each phase will be analyzed. \cite{eventloop:nodejs}
  443. \paragraph{Timers}
  444. Callbacks from the setTimeout method will be placed in the timers phase's queue. This JavaScript method is used to specify a time period after which the callback function should be called. But since the event loop goes through multiple phases of variable lengths\footnote{In order to stop a phase from running too long and delaying other phases, a time limit is imposed on the length of the phase}, it can not be guaranteed that the callback function will be executed after that exact time interval, but rather after the timer expires.
  445. \paragraph{Pending callbacks}
  446. The callbacks which need to be executed in the next iteration of the event loop are put in this phase's queue. For instance, callbacks for some types of errors need to wait to report the error.
  447. \paragraph{Poll}
  448. Most callbacks used by the developer will end up in the poll phase's queue. That is because, once the system kernel finishes with the I/O operation, it puts the callback into this queue. If there are no callbacks ready in this phase, the event loop will block the execution and wait for a certain amount of time before continuing(unless there are callbacks ready in the check phase's queue or there are timer callbacks ready to execute). It does that because during that time, some callbacks might be added to the queue. The developer can avoid this feature if needed by using the setImmediate method. This method places a callback function in the check phase's queue. If both the poll and check phase's queues are empty, and there are callbacks in the timer phase's queue ready, the event loop will go back to the timer phase in order to accomplish a more precise execution of the setTimeout method.
  449. \paragraph{Check}
  450. The check phase contains the higher priority callbacks. If there is a situation where the poll phase has no callbacks ready, and timer and check phases both have ready callbacks, the event loop will prioritize the callbacks from the check queue.
  451. \paragraph{Close}
  452. In this phase, the event loop will handle the callbacks of abruptly closed sockets or streams. If the stream closes normally, the callback will be executed via the nextTick method.
  453.  
  454.  
  455. The nextTick method allows the user to bypass the event loop. It executes the callback given to it at the end of the currently executed operation\footnote{In this case an operation is defined as a transition between the JavaScript and V8 engine's native code.}.
  456.  
  457. \subsubsection{Single-threaded pattern}
  458. Unlike most other server side technologies, a Node.js program is single-threaded. This is made possible by using the event loop in combination with asynchronous I/O operations. This frees up the processor more than Node.js's multi-threaded alternatives.
  459.  
  460.  
  461. \section{Performance comparison}
  462. In this part we will go into detail about differences in
  463. technologies that affect performance and analyze concrete
  464. results in different environments. The technologies against which Node.js will be compared are Python-web and PHP\cite{performance:lei} in the first part, and Apache and EventMachine, an evented Ruby web server\cite{performance:mccune} in the second part of this section.
  465. \subsection{Reasons behind the differences}
  466. The main reasons for the differences in performance are that Node.js uses asynchronous I/O function calls and that Node.js is a single-threaded web technology, unlike most of the popular alternatives.
  467. \subsubsection{Single-threaded versus Multi-threaded client serving}
  468. In this subsection we will go over how the server handles client requests depending on the fact whether it is single-threaded or multi-threaded and how it affects server performance.
  469. \paragraph{Single-threaded}
  470. The servers main thread has to serve each client. But that same thread also has to listen for incoming requests from other clients and put them in a queue. Because of this, if there are many requests coming to the server, a client can wait for a long time before the server is available. Especially problematic are the requests that take a long time to finish, because the server is unavailable to other clients. The server has to find a way to get around these issues and be fair to all of it's clients.
  471. \paragraph{Multi-threaded}
  472. In this case, the server's main thread's only duty is to listen to incoming requests from the clients. Once the request comes, the server spawns a new thread to take care of it. Like this, multiple clients can be served by the server at the same time. The problem that comes with this approach is that spawning and managing threads is costly for the processor and therefore has a negative effect on the performance. Other than that, another issue is that there is a limited number of threads that can run efficiently at the same time. Therefore, if there are too many clients, a multi-threaded server will not be much faster than a single-threaded one.
  473.  
  474.  
  475. \subsubsection{Synchronous versus Asynchronous I/O operations}
  476. In this subsection we will go over how the server handles I/O operations depending on whether the technology is synchronous or asynchronous and what effect that has on server performance.
  477. \begin{figure}[ht]
  478. \centering
  479. \includegraphics[width=0.9\linewidth]{synchronous_versus_asynchronous}
  480. \caption{Synchronous versus asynchronous programming}
  481. \label{fig:synchronousversusasynchronous}
  482. \end{figure}
  483. \paragraph{Synchronous}
  484. In synchronous handling of I/O operations, the thread that serves the client gets blocked until the I/O operation finishes. The issue is that during that time, the server thread can not be used for anything else\ref{fig:synchronousversusasynchronous}. The processor can switch to another thread(if the server is multi-threaded), but the transition also requires some time. This can also be problematic because most requests include some I/O operations.
  485. \paragraph{Asynchronous}
  486. When it comes to asynchronous I/O operations, the calling thread will not wait for the I/O operation to finish\ref{fig:synchronousversusasynchronous}, but rather execute other operations that are not dependent on the I/O function finishing. This can have a positive effect on the server performance.
  487.  
  488. Node.js combines the single-threaded approach with asynchronous I/O function calls. By doing this, it maximizes efficiency in serving a large number of clients. It is especially good if the requests are data intensive, but it has drawbacks when the requests are computationally heavy.
  489. \subsection{Node.js against Python-web and PHP}
  490. In this section, we will analyze how Node.js compares to Python-web and PHP. This section will heavily rely on experiments performed and described in a related work\cite{performance:lei}. The experiments go over a couple of different server benchmark tests. it simulates 10000 requests from each client, and the number of clients change between 10, 100, 200, 500, and 1000. The first experiment will be a regular stress test, the second one will be a computational intensive test and the third one will be an I/O intensive test.
  491. \subsubsection{Regular stress test}
  492. In this test clients send requests, and the server responds only with a "Hello world" string. This is neither I/O intensive nor computational intensive, but it tests how well the server runtime handles a large number of requests. Figures \ref{fig:resultsstress1} and \ref{fig:resultsstress2} show the results of the test. Figure \ref{fig:resultsstress1} shows how many requests per second the server can handle depending on the number of users that are sending these requests. A trending can be seen that each server's performance improves with the increasing number of users, up until some point, after which it decreases. The results show that Node.js can handle the largest number of requests out of the three technologies used. It also does not lose it's performance as drastically as PHP when the number of users increases. Figure \ref{fig:resultsstress2} shows how much time it takes the server to respond to user requests. It can be noticed that Node.js outperforms its alternatives in this regard too. Once again, PHP's performance decreases rapidly with the increasing number of users. Python-web is fine in this aspect, but it is still lacking compared to Node.js. The conclusion here is that Node.js handles the regular stress test the best.
  493. \begin{figure}[ht]
  494. \centering
  495. \includegraphics[width=0.9\linewidth]{results1}
  496. \caption{Results of the regular stress test, mean requests per second in relation to client count\cite{performance:lei}}
  497. \label{fig:resultsstress1}
  498. \end{figure}
  499. \begin{figure}[ht]
  500. \centering
  501. \includegraphics[width=0.9\linewidth]{results2}
  502. \caption{Results of the regular stress test, time needed for server to respond in relation to client coun\cite{performance:lei}t}
  503. \label{fig:resultsstress2}
  504. \end{figure}
  505.  
  506.  
  507. \subsubsection{CPU intensive test}
  508. In this test clients send requests, and the server has to calculate the tenth number of the Fibonnaci Sequence and return it as the result. This request is computationally heavy, since the server has to do a lot of calculating all over again for each request. Figures \ref{fig:resultscpu1} and \ref{fig:resultscpu2} show the results of the test. Figure \ref{fig:resultscpu1} shows how many requests per second the server can handle depending on the number of users that are sending these requests. Figure \ref{fig:resultscpu2} shows how much time it takes the server to respond to user requests. The results shown are very similar to the ones from the regular stress test, but with some differences. Once again, Node.js is better than the other two when the number of users is over 200. But at a lower number of users, PHP outperforms Node.js in terms of both of the criteria. There have also been tests for the twentieth and thirtieth Fibonnaci number, in order to further explore this type of test. The results show that each technology falls off drastically, as the Fibonnaci
  509.  
  510.  
  511. \begin{figure}[ht]
  512. \centering
  513. \includegraphics[width=0.9\linewidth]{results3}
  514. \caption{Results of the CPU intesive test, mean requests per second in relation to client count\cite{performance:lei}}
  515. \label{fig:resultscpu1}
  516. \end{figure}
  517. \begin{figure}[ht]
  518. \centering
  519. \includegraphics[width=0.9\linewidth]{results4}
  520. \caption{Results of the regular stress test, time needed for server to respond in relation to client count\cite{performance:lei}}
  521. \label{fig:resultscpu2}
  522. \end{figure}
  523.  
  524. \subsubsection{Static contents delivery test}
  525. \subsubsection{IO intensive test}
  526.  
  527. \section{Scalability comparison}
  528. In this part we will go into detail about differences in
  529. technologies that affect scalability and describe the key features
  530. of Node that make it easily scalable.
  531. \subsection{Reasons behind the differences}
  532. \subsection{“Horizontal scaling” on a single machine}
  533. \subsection{Node clustering}
  534. \subsection{NoSQL databases and eventual consistency}
  535.  
  536. \section{Drawback of using node.js}
  537. In this part we will go into detail about differences in
  538. technologies that affect server security, code readability and
  539. reusability etc.
  540. \subsection{Single-threaded pattern flaws}
  541. \subsection{Why Node is not used in enterprise}
  542. \subsection{Security flaws caused by performance}
  543. \subsection{Synchronization problems because of eventual consistency}
  544.  
  545. \section{Results and discussions}
  546.  
  547. \section{Conclusion}
  548.  
  549.  
  550. \begin{thebibliography}{1}
  551.  
  552. \bibitem{node_basic:tilkov}
  553. Tilkov, S., \& Vinoski, S. (2010). Node. js: Using JavaScript to build high-performance network programs. IEEE Internet Computing, 14(6), 80-83.\\
  554. This paper serves as a good starting point to get introduced to Node.js. It goes over the basics of how Node works and the pros and cons of event driven programming.
  555.  
  556. \bibitem{performance:lei}
  557. Lei, K., Ma, Y., \& Tan, Z. (2014, December). Performance comparison and evaluation of web development technologies in php, python, and node. js. In 2014 IEEE 17th international conference on computational science and engineering (pp. 661-668). IEEE.\\
  558. This paper goes deeply into performance analysis and comparison between Node.js and two other popular backend technologies. It graphically presents the results gathered in different tests performed over those platforms and it is a great head start for research.
  559. \bibitem{security:ojamaa}
  560. Ojamaa, A., \& Düüna, K. (2012, December). Assessing the security of Node. js platform. In 2012 International Conference for Internet Technology and Secured Transactions (pp. 348-355). IEEE.
  561. This paper goes over security pitfalls of the Node.js platform. It contains an explanation of Node.js advantages too, but it is mainly about the many flaws that come with using a frontend language and a technology that does not emphasize security to write server logic. It also gives two ways to cause denial of service in Node.js servers that have been undocumented before.
  562. \bibitem{presentation:dahl}
  563. Dahl, R., (2009, November 8) node.js\\Retrieved from\\ \url{https://www.slideshare.net/AartiParikh/original-slides-from-ryan-dahls-nodejs-intro-talk}\\
  564. This is the original presentation on node.js given by its creator Ryan Dahl.
  565.  
  566. \bibitem{npm}
  567. Npm. (2010). Retrieved from \url{https://www.npmjs.com/}
  568. This is the official site for the node package manager, npm.
  569.  
  570. \bibitem{eventloop:nodejs}
  571. Node js documentation. Retrieved from \url{https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/}
  572. This is the official node js documentation.
  573.  
  574. \bibitem{performance:mccune} McCune, R. R. (2011). Node. js paradigms and benchmarks. Striegel, Grad Os F, 11, 86.
  575. In this paper, Node.js is compared to Apache and EventMachine web technologies in terms of performance.
  576. \end{thebibliography}
  577.  
  578.  
  579.  
  580.  
  581. % that's all folks
  582. \end{document}
  583.  
  584.  
  585. % An example of a floating figure using the graphicx package.
  586. % Note that \label must occur AFTER (or within) \caption.
  587. % For figures, \caption should occur after the \includegraphics.
  588. % Note that IEEEtran v1.7 and later has special internal code that
  589. % is designed to preserve the operation of \label within \caption
  590. % even when the captionsoff option is in effect. However, because
  591. % of issues like this, it may be the safest practice to put all your
  592. % \label just after \caption rather than within \caption{}.
  593. %
  594. % Reminder: the "draftcls" or "draftclsnofoot", not "draft", class
  595. % option should be used if it is desired that the figures are to be
  596. % displayed while in draft mode.
  597. %
  598. %\begin{figure}[!t]
  599. %\centering
  600. %\includegraphics[width=2.5in]{myfigure}
  601. % where an .eps filename suffix will be assumed under latex,
  602. % and a .pdf suffix will be assumed for pdflatex; or what has been declared
  603. % via \DeclareGraphicsExtensions.
  604. %\caption{Simulation results for the network.}
  605. %\label{fig_sim}
  606. %\end{figure}
  607.  
  608. % Note that the IEEE typically puts floats only at the top, even when this
  609. % results in a large percentage of a column being occupied by floats.
  610.  
  611.  
  612. % An example of a double column floating figure using two subfigures.
  613. % (The subfig.sty package must be loaded for this to work.)
  614. % The subfigure \label commands are set within each subfloat command,
  615. % and the \label for the overall figure must come after \caption.
  616. % \hfil is used as a separator to get equal spacing.
  617. % Watch out that the combined width of all the subfigures on a
  618. % line do not exceed the text width or a line break will occur.
  619. %
  620. %\begin{figure*}[!t]
  621. %\centering
  622. %\subfloat[Case I]{\includegraphics[width=2.5in]{box}%
  623. %\label{fig_first_case}}
  624. %\hfil
  625. %\subfloat[Case II]{\includegraphics[width=2.5in]{box}%
  626. %\label{fig_second_case}}
  627. %\caption{Simulation results for the network.}
  628. %\label{fig_sim}
  629. %\end{figure*}
  630. %
  631. % Note that often IEEE papers with subfigures do not employ subfigure
  632. % captions (using the optional argument to \subfloat[]), but instead will
  633. % reference/describe all of them (a), (b), etc., within the main caption.
  634. % Be aware that for subfig.sty to generate the (a), (b), etc., subfigure
  635. % labels, the optional argument to \subfloat must be present. If a
  636. % subcaption is not desired, just leave its contents blank,
  637. % e.g., \subfloat[].
  638.  
  639.  
  640. % An example of a floating table. Note that, for IEEE style tables, the
  641. % \caption command should come BEFORE the table and, given that table
  642. % captions serve much like titles, are usually capitalized except for words
  643. % such as a, an, and, as, at, but, by, for, in, nor, of, on, or, the, to
  644. % and up, which are usually not capitalized unless they are the first or
  645. % last word of the caption. Table text will default to \footnotesize as
  646. % the IEEE normally uses this smaller font for tables.
  647. % The \label must come after \caption as always.
  648. %
  649. %\begin{table}[!t]
  650. %% increase table row spacing, adjust to taste
  651. %\renewcommand{\arraystretch}{1.3}
  652. % if using array.sty, it might be a good idea to tweak the value of
  653. % \extrarowheight as needed to properly center the text within the cells
  654. %\caption{An Example of a Table}
  655. %\label{table_example}
  656. %\centering
  657. %% Some packages, such as MDW tools, offer better commands for making tables
  658. %% than the plain LaTeX2e tabular which is used here.
  659. %\begin{tabular}{|c||c|}
  660. %\hline
  661. %One & Two\\
  662. %\hline
  663. %Three & Four\\
  664. %\hline
  665. %\end{tabular}
  666. %\end{table}
  667.  
  668.  
  669. % Note that the IEEE does not put floats in the very first column
  670. % - or typically anywhere on the first page for that matter. Also,
  671. % in-text middle ("here") positioning is typically not used, but it
  672. % is allowed and encouraged for Computer Society conferences (but
  673. % not Computer Society journals). Most IEEE journals/conferences use
  674. % top floats exclusively.
  675. % Note that, LaTeX2e, unlike IEEE journals/conferences, places
  676. % footnotes above bottom floats. This can be corrected via the
  677. % \fnbelowfloat command of the stfloats package.
  678.  
  679. % conference papers do not normally have an appendix
  680.  
  681. % use section* for acknowledgment
  682.  
  683. % trigger a \newpage just before the given reference
  684. % number - used to balance the columns on the last page
  685. % adjust value as needed - may need to be readjusted if
  686. % the document is modified later
  687. %\IEEEtriggeratref{8}
  688. % The "triggered" command can be changed if desired:
  689. %\IEEEtriggercmd{\enlargethispage{-5in}}
  690.  
  691. % references section
  692.  
  693. % can use a bibliography generated by BibTeX as a .bbl file
  694. % BibTeX documentation can be easily obtained at:
  695. % http://mirror.ctan.org/biblio/bibtex/contrib/doc/
  696. % The IEEEtran BibTeX style support page is at:
  697. % http://www.michaelshell.org/tex/ieeetran/bibtex/
  698. %\bibliographystyle{IEEEtran}
  699. % argument is your BibTeX string definitions and bibliography database(s)
  700. %\bibliography{IEEEabrv,../bib/paper}
  701. %
  702. % <OR> manually copy in the resultant .bbl file
  703. % set second argument of \begin to the number of references
  704. % (used to reserve space for the reference number labels box)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement