Skip to content

Commit ded6de3

Browse files
committed
txs auto checkin
1 parent ce29dfc commit ded6de3

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

rust.tex

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,7 +1790,6 @@ \section{Generic Types, Traits, and Lifetimes}
17901790
\end{frame}
17911791

17921792
\section{Writing Automated Tests}
1793-
17941793
\begin{frame}[fragile]
17951794
\frametitle{The Anatomy of a Test Function}
17961795

@@ -3200,7 +3199,43 @@ \section{Advanced Features}
32003199
\inputminted{rust}{./code/macro8.rs}
32013200
\end{frame}
32023201
3202+
32033203
\section{Multithread Web Server}
3204+
\begin{frame}[fragile]
3205+
\frametitle{Building a Single-Threaded Web Server}
3206+
\begin{itemize}
3207+
\item The two main protocols involved in \textbf{web servers} are \textbf{Hypertext Transfer Protocol (HTTP)} and \textbf{Transmission Control Protocol (TCP)}. Both protocols are \textbf{request-response protocols}, meaning a client initiates requests and a server listens to the requests and provides a response to the client. The contents of those requests and responses are defined by the protocols.
3208+
\item TCP is the lower-level protocol that describes the details of how information gets from one server to another but doesn’t specify what that information is. HTTP builds on top of TCP by defining the contents of the requests and responses.
3209+
\end{itemize}
3210+
3211+
\end{frame}
3212+
3213+
3214+
\begin{frame}[fragile]
3215+
\frametitle{Building a Single-Threaded Web Server (2)}
3216+
\inputminted[fontsize=\scriptsize]{rust}{./code/http1.rs}
3217+
\end{frame}
3218+
3219+
\begin{frame}[fragile]
3220+
\frametitle{Building a Single-Threaded Web Server (3)}
3221+
\inputminted[fontsize=\scriptsize]{shell}{./code/http1.shell}
3222+
\end{frame}
3223+
3224+
3225+
3226+
\begin{frame}[fragile]
3227+
\frametitle{Spawning a Thread for Each Request}
3228+
\inputminted{rust}{./code/http2.rs}
3229+
3230+
This will eventually overwhelm the system because you’d be making new threads without any limit
3231+
\end{frame}
3232+
3233+
3234+
\begin{frame}[fragile]
3235+
\frametitle{Improving Throughput with a Thread Pool}
3236+
\inputminted{rust}{./code/http2.rs}
3237+
\end{frame}
3238+
32043239
\section{Tokio}
32053240
32063241
\section*{Acknowledgement}

0 commit comments

Comments
 (0)