aboutsummaryrefslogtreecommitdiff
path: root/Report
diff options
context:
space:
mode:
authorTom Harley2018-03-07 15:04:13 +0000
committerTom Harley2018-03-07 15:04:13 +0000
commit1ac6dee8816d34853c4875a3fbcf1c881fd13dcc (patch)
treecd982c893a4edd0c2ea928c778cfbe4afebf881f /Report
parentMention logging in report (diff)
downloadmedicine-1ac6dee8816d34853c4875a3fbcf1c881fd13dcc.tar.gz
medicine-1ac6dee8816d34853c4875a3fbcf1c881fd13dcc.zip

Add information on process management

Diffstat (limited to 'Report')
-rw-r--r--Report/biblio.bib22
-rw-r--r--Report/main.tex1
-rw-r--r--Report/texts/logging.tex12
-rw-r--r--Report/texts/process-management.tex56
4 files changed, 91 insertions, 0 deletions
diff --git a/Report/biblio.bib b/Report/biblio.bib
index d0accd4..7c4d0fa 100644
--- a/Report/biblio.bib
+++ b/Report/biblio.bib
@@ -137,3 +137,25 @@
year = {2017},
note = {Accessed: 2018-03-02}
}
+
+@misc {strongloop,
+ howpublished = {https://strongloop.com/},
+ title = {StrongLoop},
+ publisher = {IBM},
+ year = {2018},
+ note = {Accessed: 2018-03-07}
+}
+
+@misc {pm2,
+ howpublished = {http://pm2.keymetrics.io/},
+ title = {pm2},
+ publisher = {KeyMetrics},
+ note = {Accessed: 2018-03-07}
+}
+
+@misc {forever,
+ howpublished = {https://github.com/foreverjs/forever},
+ title = {foreverjs},
+ publisher = {foreverjs},
+ note = {Accessed: 2018-03-07}
+}
diff --git a/Report/main.tex b/Report/main.tex
index 812a482..26c4a10 100644
--- a/Report/main.tex
+++ b/Report/main.tex
@@ -12,6 +12,7 @@
% \input{texts/protocol}
% \input{texts/auth}
\input{texts/logging}
+ \input{texts/process-management}
% \input{texts/testing}
\input{texts/conclusion}
diff --git a/Report/texts/logging.tex b/Report/texts/logging.tex
index 1f48ff2..d0a7255 100644
--- a/Report/texts/logging.tex
+++ b/Report/texts/logging.tex
@@ -24,3 +24,15 @@ should be retreivable, the output queries can be stored with less associated
metadata. In addition, Sequelize can output the total required time to
process the query, which is stored in the log for future use as profiling
data.
+
+\subsection{Motivation}
+Since basic server functionality has been implemented, the errors produced
+will likely be caused by difficult-to-debug problems, such as edge-cases or
+data races. With a verbose and thorough logging system, these problems
+should be much easier to detect and rectify.
+
+In addition, Protocol BE01~\cite{protocol} requires of the backend support
+for receiving and storing logs from other services. The introduction of a
+well-implemented logging system abstracts this from the common use-case of
+logging while keeping powerful functionality of forwarding and fetching logs
+available for when it is needed.
diff --git a/Report/texts/process-management.tex b/Report/texts/process-management.tex
new file mode 100644
index 0000000..bb40faa
--- /dev/null
+++ b/Report/texts/process-management.tex
@@ -0,0 +1,56 @@
+\section{Process Management and Deployment}\label{sec:pm}
+In a production environment, many instances of a NodeJS server are run on
+one machine; this way NodeJS applications can make use of multiple
+processors. For this purpose, research into \emph{process managers} ---
+applications used for running and managing production-level systems ---
+was carried out.
+
+\subsection{Process Manager Selection}\label{sec:pms}
+A number of process managers were investigated with the hope of
+incorporating them into the production
+system~\cite{strongloop}\cite{pm2}\cite{forever}. The application pm2 was
+chosen, primarily for its highly-configurable \emph{ecosystem}-config files,
+and \emph{pmx}\footnote{https://github.com/keymetrics/pmx},
+its profiling extension.
+
+\subsection{pm2 and KeyMetrics}\label{sec:pm2}
+
+\begin{figure}
+ \centering
+ % \includegraphics[width=0.5\linewidth]{km-dash}
+ \caption{The KeyMetrics dashboard web client in use.}\label{fig:dash}
+\end{figure}
+
+A feature available in \emph{pm2} is the ability to transmit profiling
+statistics to a web client, as a dashboard. The dashboard also allows the
+user to remotely issue commands to the running instances. Further,
+custom profiling information, and custom remote commands, can be created
+through the introduction of simple logic into the codebase.
+
+\subsection{Process Limitations}\label{sec:plim}
+Running multiple NodeJS instances can quickly accumulate counts towards a
+user process limit: each instance hosts several threads, and each connection
+to the PostgreSQL database can pool several threads also, resulting in many
+threads per instance. Compounded with the fact that pm2 itself also runs
+as a NodeJS instance, this means that a user can reach their process limit
+on the host labs very quickly. Using \texttt{nolimit} on process
+instantiation is one solution, however this means having to run
+\texttt{nolimit} when starting the databse, deamonising the process manager,
+starting the server instances, and doing any miscellaneous tasks. This
+limitation has stunted hindered attempts to connect to other teams'
+products.
+
+\subsection{Heroku Hosting}\label{sec:her}
+In response to the issues addressed in \S\ref{sec:plim}, an attempt to host
+an instance of the server on hosting service
+\emph{Heroku}\footnote{https://heroku.com/} has been started. This would
+alloow the team to interact with other teams, without using a member's
+process limit and hindering their productivity. Additionally, it would show
+the deployability of the system --- an important factor for a backend
+server.
+
+\subsection{External System Hosting}\label{sec:ext}
+Another option is to host instances of the system on devices personally
+owned by members of the team. This would give the team absolute control over
+configuration of the sytem, and would have the potential to outperform an
+instance running on a complementary Heroku service.