Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Which OS is Fastest for High-Performance Network Applications?


How To Determine Which Network Programming Architecture Is Being Used

Figure 1 | Figure 2 | Figure 3 | Sidebar 1 | Sidebar 2 | Article

Most program documentation remains vague about which network programming architecture is used. Since the architecture is the single strongest determinant of performance under load, you need a way to find out. Below are techniques you can use snoop on an application, even if you do not have access to the source code. First, you must set up a load-creating situation, with at least 200 simultaneous tasks. Then, examine how the process is running with various tools:

Linux

  • Run top

  • One-process-per-task — Many processes running, all with a different amount of memory use.

  • One-thread-per-task — Many processes running, all with the same amount of memory use, and the number of processes changes over time.

  • One-thread-many-tasks (one thread) — A single process running.

  • One-thread-many-tasks (several threads) — Many processes running, all with the same amount of memory use, and the number of processes is less than 100.

Solaris

  • Run ps -efL. The “NLWP” column indicates how many “lightweight processes” are running inside each process, and lists each LWP in a separate row.

  • One-process-per-task — ps -efL reports multiple copies of your application, but each has a different process ID, then the application uses the process-per-task approach.

  • One-thread-per-task — Multiple processes reported by ps -efL for your application. If all have the same process ID, and the number of copies changes over time, then the application uses the one-thread-per-task (multi-threaded) approach.

  • One-thread-many-tasks (one thread) — A single process reported.

  • One-thread-many-tasks (several threads) — Multiple copies of your application reported by ps - efL, all running copies of your application have the same process ID, and the number of copies is less than 100.

Windows 2000 and NT

  • Use Task Manager to view active tasks and perfmon.exe to view the number of threads in the running task.

  • One-process-per-task — Task Manager shows approximately one process per running task.

  • One-thread-per-task — perfmon.exe shows approximately one thread per running task.

  • One-thread-many-tasks (one thread) — One process, one thread.

  • One-thread-many-tasks (several threads) — Task Manager shows one process; perfmon.exe shows less than 100 threads.

Alternative Snooping Technique: Trace the System Calls

  • Use strace (on Linux) or truss (on Solaris and FreeBSD) to display the application’s system calls.

  • grep for calls to “select” or “poll”, which usually indicate asynchronous operations. Poll() is more efficient than select() with large numbers of connections.

  • grep for calls that start with aio (which stands for Asynchronous I/O) or lio (List I/O). These calls are a likely sign of a sophisticated asynchronous architecture. Examples: aio_write(), aio_read(), lio_listio().

  • grep for calls that start with “pthread” or “thr_” (on Solaris), which indicates some amount of multi-threading. If a new task always causes a call the pthread_create(), then the “one-thread-per-task” design is being used.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.