Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    SG-2440 high cpu/sluggish while urandom

    Scheduled Pinned Locked Moved Official Netgate® Hardware
    2 Posts 2 Posters 307 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rofl
      last edited by

      System:
      2.4.4-RELEASE-p3 (amd64)
      Netgate SG-2440

      Im doing some /dev/urandom creating files for testing speed. While creating these files the system becomes really sluggish and even stops system from time to time:

      $ dd if=/dev/random of=/tmp/speedtest bs=1024 count=100000
      

      top -aSH:

         19 root       -16    -     0K    16K CPU0    0 218:52 100.00% [rand_harvestq]
         11 root       155 ki31     0K    32K RUN     0 647:33  78.04% [idle{idle: cpu0}]
         11 root       155 ki31     0K    32K RUN     1 515:38  20.94% [idle{idle: cpu1}]
      

      I have tracked some issues in FreeBSD regarding this:
      https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230808
      https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219216
      https://svnweb.freebsd.org/base?view=revision&revision=345981

      Are there any known fixes/workarounds for this?

      1 Reply Last reply Reply Quote 0
      • kiokomanK
        kiokoman LAYER 8
        last edited by kiokoman

        random != urandom

        random device will only return random bytes within the estimated number of bits of noise in the entropy pool. when the entropy pool is empty, reads from /dev/random will block until additional environmental noise is gathered

        urandom device will not block waiting for more entropy.

        When you need random data fast, you should use /dev/urandom
        For cryptographic purposes you should use /dev/random

        kiokoman@nanto:~$ dd if=/dev/random of=/tmp/speedtest bs=1024 count=100000
        dd: warning: partial read (115 bytes); suggest iflag=fullblock
        0+100000 record in
        0+100000 record out
        8194031 bytes (8,2 MB, 7,8 MiB) copied, 8,15628 s, 1,0 MB/s
        
        kiokoman@nanto:~$ dd if=/dev/urandom of=/tmp/speedtest bs=1024 count=100000
        100000+0 record in
        100000+0 record out
        102400000 bytes (102 MB, 98 MiB) copied, 1,88982 s, 54,2 MB/s
        

        ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
        Please do not use chat/PM to ask for help
        we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
        Don't forget to Upvote with the 👍 button for any post you find to be helpful.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.