sdkperf file input format

szanin Member Posts: 2

I am trying to test my application with sdkperf to control the number of messages published per second and I am finding the sdkperf_c tool very useful, however the documentation doesn't explain clearly how to structure the text file when using the -sdm option. I would like to send a message containing a string, and defining peroperties under UserPropertyMap. I would also like to understand better the structure of the message in the example file. Are there any resources about this?


  • UshShukla
    UshShukla Member, Employee Posts: 4 Solace Employee
    edited January 2021 #2

    Hey there Szanin,
    Have you reviewed the example documented here under the Publish/Subscribe to Persistent Messages with Selectors and Structured Data section?

    sdkperf_c -cip=HOST -pql=queue -mt=persistent -mn=1 -mr=1 –sdm=sdm1.txt
    Where the contents of sdm1.txt are:

    msg: type=map
    msg: useBinaryAttachment=0
    bool   name=a value=0
    uint16 name=b value=3
    int16  name=c value=4
    uint32 name=d value=5
    int32  name=e value=6
    uint64 name=f value=7
    int64  name=g value=8
    string name=h value=matchTopic
    float  name=i value=1.2345678
    double name=j value=2.3456789
  • marc
    marc Member, Administrator, Moderator, Employee Posts: 923 admin

    Thanks for sharing @UshShukla. @szanin hope that worked for you!

  • szanin
    szanin Member Posts: 2

    Well, my question was really intended to get some help clarifying the content of that sdm1.txt file.
    It's not clear what properties are set, and whether different inputs can be used, or if the structure has to strictly follow that schema, as in:

    msg: type=map
    msg: useBinaryAttachment=0
    bool   name=a value=0

    What does the type=map flag mean, what happens if the useBinaryAttachment value is set to 1? Are there more flags that can be set in the same way as type and useBinaryAttachment? Is it possible to add UserPropertyMap properties in the context of this kind of input?

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 541 admin

    Hi @szanin ... I realize this thread is a bit old, but thought I'd put an answer here if anyone is ever looking through this:

    Ok, so the -sdm argument is currently only available with the C flavour of SdkPerf. It allows you to either: specify a specially-formatted SDTMap message (when msg: useBinaryAttachment=1)... that is, the PAYLOAD of the message will be a structured map format using Solace SDT; or if useBinaryAttachment=0 then it will populate the User Property section of the message. The latter is used to pass custom headers to downstream applications, and they also have special meaning in the REST protocol and JMS protocol (e.g. in JMS you can use Selectors on the User Properties map).

    In the example that @UshShukla gave, modified from the docs page, the use binary attachment == 0, so SdkPerf used the contents of that file to populate the User Properties. The first two lines of it are required, but then the rest of the file is just a listing of key/value pairs. For example, if I have two text files that look like:

    $ cat userprops.txt
    msg: type=map
    msg: useBinaryAttachment=0
    string name=Custom_Prop_Aaron value=this is a value
    int32 name=How_About_Numeric value=123
    $ cat payload.txt
    This is a payload.

    then when I send it:

    ./sdkperf_c -cip=localhost -ptl=abc -mn=1 -sdm=userprops.txt -pal=payload.txt

    The consuming application receives something that looks like:

    ^^^^^^^^^^^^^^^^^^ Start Message ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Destination:                            Topic 'abc'
    Priority:                               4
    Class Of Service:                       COS_1
    DeliveryMode:                           DIRECT
    User Property Map:
      Key 'Custom_Prop_Aaron' (STRING) this is a value
      Key 'How_About_Numeric' (INT32) 123
    User Data:                              len=1
      32                                                    2
    Binary Attachment:                      len=19
      54 68 69 73 20 69 73 20  61 20 70 61 79 6c 6f 61      This is    a payloa
      64 2e 0a                                              d..
    ^^^^^^^^^^^^^^^^^^ End Message ^^^^^^^^^^^^^^^^^^^^^^^^^^^

    So you could use this if you wanted (for example) set some specific custom user property headers for interaction with Solace REST messaging:

    The only issue is that sdkperf_c cannot send a TextMessage at the same time as setting the User Property map. This is because a Text Message is a specially formatted SDT. Unlike the above example, where I'm just sending a UTF-8 string as a raw binary payload.

    And to quickly answer your questions:

    What does the type=map flag mean

    It means the file is in "map" format. Solace SDT messages can also be Stream messages. But this does not apply to the User Properties.

    what happens if the useBinaryAttachment value is set to 1?

    As mentioned above, it uses the map for the payload instead of User Property map. You could see that if your sdkperf_c consumer app was just dumping -md all messages to console.

    Are there more flags that can be set in the same way as type and useBinaryAttachment?

    I don't believe so. What specifically are you trying to do? Honestly, in my 10 years at Solace I've rarely ever used this particular feature of SdkPerf.

    Hope this helps! Let me know.