Memory Usage Test Results for CoAPSharp v 0.3.0

Memory Usage Test Results for CoAPSharp v 0.3.0

A lot of people have asked us about memory usage by CoAPSharp library at runtime. This is a very fair question to ask. Given that we are talking about constrained devices, it becomes necessary to know this information. Therefore, we conducted basic memory usage tests and we are publishing the results for everyone to comment and suggest. We believe, collaborative effort is the best way to improve things.

Before you read the results, let us provide basic information on how the test was conducted.

  1. We ran the test on emulator and then on the actual Netduino Plus 2 boards.
  2. On actual Netduino Plus 2 boards, we had to write the results in a file (on the mounted SD card). That resulted in more memory usage. We do not know how to separate the memory used only by the CoAPSharp library and the ones by the SD card library. Our assumption is that the lower of the two is the right figure, which is, the one we got on the emulator.
  3. The version of CoAPSharp was V 0.3.0 running on .NET Micro Framework 4.2
  4. We ran each test 50 times. For cases where looping was required internally (like observe and block transfer), each loop was executed 10 times.
  5. We took the average value, the minimum value, the maximum value and the standard deviation.
  6. The reason for taking standard deviation is to see that results do not vary too much.

Note: To perform the test, we have taken typical payload types, meaning, a request that has a URL, a token (6 bytes) and a payload (about 10 – 40 bytes).

The results are given below for your consumption, criticism and feedback. Do let us know your views so that we can make this a better library.

CoAPSharp Client Memory Usage Test Results

CoAPSharp Client Memory Usage Test Results

CoAPSharp Server Memory Usage Test Results

CoAPSharp Server Memory Usage Test Results

 

4 Responses so far.

  1. Paolo says:

    Hi,
    How did you get the memory usage ?
    Can you show the source code ?

    Paolo

    • administrator says:

      You can use Debug.GC() method available in Microsoft.SPOT.Native assembly. That’s the only code we are using. This method returns the free (unused) memory in bytes. Therefore, to check for memory usage, you can take an approach like this:
      int freeBytesBeforeAnyCalls = Debug.GC(true);
      ….make some calls here…
      int freeBytesAfterCalls = Debug.GC(false);
      int memory used = freeBytesBeforeAnyCalls – freeBytesAfterCalls

      Though not very accurate, it will give you some indicator (as calling GC will anyway try to clear…the only way to control it is the boolean argument). What it really tells you is which memory is still locked even after a garbage collection. That is what you really want to know, is there memory that is unclaimed that could eventually lead to blocking of precious memory.

  2. Hi
    I was just wondering what does the setup a client and connect to server mean.Since CoAP runs on UDP transport(which is a connectionless protocol) , what does connect mean here ?

    • administrator says:

      “Connectionless” does not mean you will not “connect”. In TCP/IP world, “Connectionless” means – A data transmission method used in packet switching networks by which each data unit is individually addressed and routed based on information carried in each unit, rather than in the setup information of a prearranged, fixed data channel as in connection-oriented communication. (source: Wikipedia)

      In the context of COAPSharp, connect means either to initiate communication with a remote host or to begin listening for incoming messages

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>