Replay pcap at specific speed

1,319 views
Skip to first unread message

Conor McKiernan

unread,
Apr 14, 2021, 9:38:16 AM4/14/21
to TRex Traffic Generator

Hello,

I am still quite new to TRex, I am trying to replay a certain pcap file but at different rates such as 1Gbps and 1Mbps. I am wondering if this is possible. I have read through 
https://trex-tgn.cisco.com/trex/doc/trex_stateless.html#_pcap_based_traffic_tutorials
and from my understanding you can only change the inter packet gap?

Thanks,

Conor

Besart Dollma

unread,
Apr 17, 2021, 5:01:26 AM4/17/21
to TRex Traffic Generator
Hi Conor, 
Loading the pcap simply creates a profile. Once you have a profile, when you start it, you can decide the multiplier. Take a look at the API. https://trex-tgn.cisco.com/trex/doc/cp_stl_docs/api/client_code.html?highlight=start#trex.stl.trex_stl_client.STLClient.start
Thanks,
Bes

Conor McKiernan

unread,
Apr 20, 2021, 4:11:07 AM4/20/21
to TRex Traffic Generator
Hi Besart,
Thanks for getting back to me. It seems that changing the multiplier doesn't affect anything for me.
I think that it is just taking the ipg rate from the pcap and just using that. Different multipliers don't seem to make an impact on the rate.
Is there a way around this?
Thanks,
Conor

hanoh haim

unread,
Apr 20, 2021, 4:45:18 AM4/20/21
to Conor McKiernan, TRex Traffic Generator
Hi Conor, 
In case of a profile that was imported from a pcap file there is no meaning to multiplier because each stream point to the next stream (each stream is packet from a pcap)
You should change the ipg to get faster replay of the pcap file 

Suneet Singh

unread,
Jul 7, 2021, 1:36:45 PM7/7/21
to TRex Traffic Generator
Hi, 

Thank you for this discussion. I am also facing the same problem. I have an ISP PCAP traces and am trying to push the PCAP on linerate (i.e., 10 Gbps) to evaluate the performance behaviour of P4 based function running on programmable switch. AFAIK, there are two options in TRex to replay the PCAP, (1) local pcap push, where the file size is limited to 1Mb and can attach maximum 20000 streams to the port, which can be replayed many times with different multipliers or rate. , (2) server based push, where PCAP size can be unlimited, but rate of transmission is usually limited by I/O performance and buffering and we can modify the rate based on IPG. 

 What I already tried are :

 1) Execute the following command, where I already set the location of ISP pcap,  --ipg_usec default value 0.001 and --loop_count 10000 
     start -p 0 -f stl/pcap.py -m 100%
     But, I can attach maximum 20000 streams to the port and the maximum rate can be achieved 2.5 Gbps. 

 2) In the 2nd option, I execute the following command: 
     push -r --port 0 -f xyz.pcap -i 0.001 -c 4 
     In this case, I can achieve maximum rate 1.75 Gbps. 

Could you please suggest, how can I perform my tests on line rate (10 Gbps) using pre-captured ISP PCAP traces ?

Thank you. 
-Suneet 

Besart Dollma

unread,
Jul 8, 2021, 9:23:20 AM7/8/21
to TRex Traffic Generator

Suneet Singh

unread,
Jul 8, 2021, 5:03:31 PM7/8/21
to TRex Traffic Generator
Thank you for your reply. 
I already tried with speedup flag for e.g., push -r -p 0 -c 4 -i 0.001 -s 1000 -f xyz.pcap, but still getting around the same throughput. The PCAP file size is around 1.70 GB.  

Screen Shot 2021-07-08 at 5.53.23 PM.png

The platform setting in trex_cfg.yaml is as follows:

  platform:
      master_thread_id:  0
      latency_thread_id: 1
      dual_if:
          - socket: 0
           threads: [2,3]


Thanks
-Suneet

Besart Dollma

unread,
Jul 9, 2021, 3:21:29 AM7/9/21
to TRex Traffic Generator
Hi Suneet, 
I doesn't make much sense to use both -i and -s. Please try and use only one. 
What pretty much is happening in the core, is this:

if (ipg_usec != -1) {
       /* fixed IPG */
       m_ipg_sec = std::max(min_ipg_sec, usec_to_sec(ipg_usec / speedup));
       m_speedup = 0;
} else {
        /* packet IPG */
        m_ipg_sec = -1;
        m_speedup = speedup;
}

Since you provided -i, you are going inside the if, and because of the values you provided we are getting 0.001 / (1000^3) can cause calculation errors.
Let's try and push only with a speedup factor of 10 and see if this speedups the traffic. 
Thanks, 

Reply all
Reply to author
Forward
0 new messages