Resource Requirements

Packet Viewer’s performance is dependent on the number of concurrent users viewing unique PCAP files and the size and contents of each file. Each PCAP file a user opens will be loaded into the RAM available to the service until there has been no activity during the sharkd-idle-timeout configuration variable.

Below is the estimated performance for a single instance of the Packet Viewer Service:

  • RAM: 512 MB
  • Users: 9
  • PCAP Size: 20 MB

It is strongly encouraged that you evaluate Packet Viewer’s performance in your own environment using a load testing tool such as k6. See our example below to get started.

k6 Load Testing

k6 is an open source tool designed for load testing. It is easy to install on the operating system of your choice and begin testing in minutes. Configure the number of users, the URL of the service, and a list of PCAPs in the TODO sections of the script below to start. After saving this to a file named script.js you can start testing by running:

k6 run script.js

Example Script:

import http from "k6/http";
import { sleep, check, fail, abortTest } from "k6";
import exec from 'k6/execution';


/// TODO: Replace this with the URL of your Packet Viewer Service. Example:
const host = 'https://localhost';

// TODO: Add a list of PCAP filenames to open in Packet Viewer. This MUST be
//       equal to the number of virtual users configured below.
const pcap_filenames = [
  '20mb-1.pcap',
  '20mb-2.pcap',
  '20mb-3.pcap',
  '20mb-4.pcap',
  '20mb-5.pcap',
]

export const options = {
  // TODO: Replace this with the number of virtual users to simulate.
  vus: 5,
  duration: "120s",
  insecureSkipTLSVerify: true,
  setupTimeout: "120s",
  // 99% of all request should succeed
  thresultholds: {
    checks: ["rate>0.99"],
  },
};

const pcap_uris = [
  'api/status?file=PCAPFILENAME',
  'api/packets/decode?file=PCAPFILENAME&frame=1',
  'api/packets/list?file=PCAPFILENAME&filter=&start=0&count=1000',
  'api/packets/decode?file=PCAPFILENAME&frame=20&prev_frame=1'
];

function rand(size) {
  return Math.floor(Math.random() * size);
}

function get_virtual_user() {
  let vu = exec.vu.idInTest - 1;
  return pcap_filenames[vu];
}

function get_url_index(index, file) {
  return `${host}/${pcap_uris[index]}`.replace(/PCAPFILENAME/, file);
}

function get_url_random(file) {
  return get_url_index(rand(pcap_uris.length), file);
}

export default function (data) {
  let filename = get_virtual_user();
  let url = get_url_random(filename);
  let result = http.get(url);
  check(result, {
    "status is 200": (r) => r.status === 200,
    "content is json": (r) =>
      r.headers["Content-Type"] &&
      r.headers["Content-Type"].includes("application/json"),
  });
  sleep(0.75 + Math.random() * 2);
}