毕设21 - 性能测试

| 笔记 | 15072 | 38分钟 | 毕设智能合约TrustZone性能测试

来活了,给项目做一下性能测试。总之要有一些性能数据。

思考

要采集哪些数据?

低频数据:

创建简单

与REE中的wasm虚拟机对比

simple counter 合约:

  • 200次query的时间 query_counter.csv

    ![Simple Query](./21/Simple Query.png)

  • tx是异步执行的,所以并发可能会一定程度提升吞吐率。

    • 统计1~32个client,每次执行5分钟,的tps、平均等待时间。

写一个 REE 中运行的 wasm 运行时,不包含安全原语:

  • 200次query的时间
  • tx的吞吐率

DID 合约:

  1. (tx)创建200个did的平均时间
  2. (query)加密200个VC的平均时间
  3. (query)验证200个VC的平均时间

创建多个账户

地址助记词
mini1s09httyypqw7r5r9p6htqkxu0dzsc8f620575d丢失
mini16rnyvqk8cku22lc7xtphntpkk0tnpc4tvj0jhdtomorrow point roof cover image sting clip inflict hello garage wisdom deny impose ask bulb axis duck love real apology fall notice wild method1
mini1kw9nh8pwzmme72efegqxksyy4tcf2qff9w72dvidentify mechanic twist actress sure ribbon ecology expose episode humor place lobster slender march bachelor jazz suffer pyramid unaware frost grain title gossip home2
mini1lwl7d7hy8qd6mvt0rx39v2ug59vz60386znnkucarpet much turkey cart family riot room major book tooth pelican addict riot ozone hire robot priority lab over giraffe trigger nephew clog visual3
mini1329azw2hzftggc4wu5qe5t2873kwstptz0mszmaddict matter this sock during erosion steak swift wool measure convince soccer memory decade pottery record drama pretty mix gorilla volcano current track rubber4
mini15g0mnntkxg8htph0xf6e3yfffpa9c4hadg6elaarmy stone visa hybrid gate kind cover flame diet leave galaxy engage boss mechanic swarm offer narrow rice ozone fatal foil cannon capable slot5
mini1gknuy37wg9w539gnszlvpc6t4xsfqfv0kly5hrbelt search lonely notice recycle lecture because shuffle nerve clever elder clay doll mixed scene cover elder web glory foam deer found move marine6
mini1pqjc95f8djmq7zp0lcu029rlm5u7mvgld4cpuurich tape enrich juice claw police wolf usage current oil violin mass level finish true satisfy soon bundle exact pond scheme breeze resist soccer7
mini1nppfg3zw8vd00fmacee7n80zepq54ujzzgcjqhhuge liquid table bamboo laptop cage audit staff orange flush wealth armor differ west dash wasp unvel report head bunker now cute alone earn8
mini1rs4jl36zh50mwtnw3cqd565rku5zrw3vqm4humimitate satoshi spy develop lecture sick goose credit brave universe valley negative pig wide galaxy green flush list essence return slight miracle hire orphan9
mini1l8f6wcfzhxu53sxysjq87ryg54785nrk3q0rf6shrimp dilemma series aware card impulse biology also car board damp staff album false camera nerve jaguar snap then lumber garlic steel charge clever10
mini1hvtqxnu2g2anlx8ufzyl7hmsfx3pm6as2t9tsdmonster chicken rice dream repeat mix match evidence essence rent cover much escape child denial rule shrug crawl brush swamp deposit exercise credit daring11
mini1gfmtmfenhj9dq4qx2jjvajmmqcfayhtd9atm2psketch kind goat panther slogan check pink twist gravity power catch punch dress wheel foot intact rhythm hidden buzz evil hurry strong always job12
mini1pqlm5thfdlnvdf37s8ns976wwv3ydqskzu8j03black shock buffalo print inch symptom uncover rice accuse road repair tonight hawk injury injury clock knife local wise pottery own wrestle catalog thrive13
mini1z4dmtxa5h6kqfwzn766jakz79mfzpg9edzngtlchampion pistol useful cereal tell enhance journey depart estate session never fashion limb version increase meat key juice enlist picnic bean wealth nasty ready14
mini1cxt9dcmpwz53fyzhfptakfws09nlqa9cmx3nduthunder blouse wife frame daring punch equal book hurry grow grass crunch cluster damage census fashion program program blush fix special shoulder buzz vessel15
mini19zngmq4fufx05sdn9gt9gd0dkjjy9e0gxq4yh5rally layer potato under car board bleak collect awesome demise blind firm daughter fresh benefit mimic nephew move awful vacuum joy ahead margin village16
mini1x3945pyuesyep4a8fu0vjeanv6cn0h5gnt03gjcrucial poet ramp artefact lounge van fuel wrong keep gallery circle asset year merge flat session peanut grocery silk ladder owner kingdom stool antenna17
mini1f4tev9wzfkt29dcpe0nfzak6rzuux45avcs7k7eager dice mystery electric portion cloud width ride mouse scare quick apple cattle picture wait regret ice eye thumb legend autumn loyal describe exhibit18
mini18kfmhgc3eplw2z3xhlz4vwezqc60p8gnu5339ktwenty mesh shoe version emerge romance bridge cannon owner monitor trash impose liquid damp method unable hire metal village belt spend dance denial junior19
mini1ygg8aw2x9u2fk4vetx3m2zjj66vm3gpmaxha7qbest polar jaguar various donate emerge return solve rotate lyrics ramp dinosaur nuclear still select industry host denial actor laundry before someone canoe start20
mini1zxt2l9qdt6sxkxhcgpekkvwnsret273lwkaf6tclaim spirit butter cricket raccoon club jacket country cook infant kiwi entry vibrant myself dice slight august ahead rotate frown uncle wire pill valley21
mini15pz7z8v9kepd6rn805u773w9llllfx7tf03g3umass attack summer lift law net sense peasant voice this behave desk clip orient pave walnut coil resource bronze giggle typical normal public clerk22
mini1qe89gve4dxcamqk0m96uxqf6q76mnguckpkuk5citizen similar donkey measure return domain mutual ozone valve upon cherry warm stem soup possible also fat clip urban question silent clip table churn23
mini1gefa64mj59a8l7la05dka8e5fmn04zplskk3rkcrime caught birth ancient afraid parrot ritual feature shuffle blossom dash kangaroo anger love broken swing horn junior lava oven cigar august urge phone24
mini1wd9aj6xlfqyqacw3fpsluwe2wwmd6sfjaqql7hart news holiday clay video gate guitar essence early chalk melt ozone salad copy chimney dance subject indicate female sea broken involve dismiss pear25
mini1y3zvucu8pp24xzwcqr2r2nurh6d795f96zsftcexample lab charge spot cherry forum glide culture boy task forget wrong debate punch spider current vague doctor hole prosper mass enhance edge protect26
mini1cjfytgrtj8kmu27mdu8e7pfc29e4609tk5seu8poet inch orient derive differ find material genre okay team unknown defense clock much gate cube void return strategy emerge author swap enhance leg27
mini1atwg4gj2l6axq6eus26r7sg42u9dvsjuaudhmgregret view tornado film camp into grape stock scorpion rose release spring grab galaxy left lawn lesson meat another diesel able toe coral evoke28
mini1p8aa0cpt22fkmdugkh6d9f3u67h226pcz0q3qebridge sister upgrade jeans annual crunch bird check casino size garden march verb sunny favorite install other wall cheese radio process smooth feature play29
mini1jwdwn6mz9rdyejvfeu7dlup4hs80mu5yx32qemproject ketchup athlete grief tone unveil race girl guide vicious again pony sail robust shiver series betray volume pizza bronze achieve desk mix business30
mini1d0z4dq7a5xxqel776znr4cdcnk4kht003lvntdsection person search brave emotion silk almost insane erase nose erosion refuse orange remove shuffle symbol charge rice green two gloom weapon list knock31
mini1pmlwxv4z6m3gvgm5zp0r44sw7gxafjz0u4av07pattern crystal pattern decrease april estate rude patient often brother salad husband immense disease absorb charge upset inflict census weird verify update loop chase32
./minid tx bank send alice mini1s09httyypqw7r5r9p6htqkxu0dzsc8f620575d 3000000mini --yes

./minid tx bank send alice mini16rnyvqk8cku22lc7xtphntpkk0tnpc4tvj0jhd 3000000mini --yes
./minid tx bank send alice mini1kw9nh8pwzmme72efegqxksyy4tcf2qff9w72dv 3000000mini --yes
./minid tx bank send alice mini1lwl7d7hy8qd6mvt0rx39v2ug59vz60386znnku 3000000mini --yes
./minid tx bank send alice mini1329azw2hzftggc4wu5qe5t2873kwstptz0mszm 3000000mini --yes
./minid tx bank send alice mini15g0mnntkxg8htph0xf6e3yfffpa9c4hadg6ela 3000000mini --yes
./minid tx bank send alice mini1gknuy37wg9w539gnszlvpc6t4xsfqfv0kly5hr 3000000mini --yes
./minid tx bank send alice mini1pqjc95f8djmq7zp0lcu029rlm5u7mvgld4cpuu 3000000mini --yes
./minid tx bank send alice mini1nppfg3zw8vd00fmacee7n80zepq54ujzzgcjqh 3000000mini --yes

./minid tx bank send alice mini1rs4jl36zh50mwtnw3cqd565rku5zrw3vqm4hum 3000000mini --yes
./minid tx bank send alice mini1l8f6wcfzhxu53sxysjq87ryg54785nrk3q0rf6 3000000mini --yes
./minid tx bank send alice mini1hvtqxnu2g2anlx8ufzyl7hmsfx3pm6as2t9tsd 3000000mini --yes
./minid tx bank send alice mini1gfmtmfenhj9dq4qx2jjvajmmqcfayhtd9atm2p 3000000mini --yes
./minid tx bank send alice mini1pqlm5thfdlnvdf37s8ns976wwv3ydqskzu8j03 3000000mini --yes
./minid tx bank send alice mini1z4dmtxa5h6kqfwzn766jakz79mfzpg9edzngtl 3000000mini --yes
./minid tx bank send alice mini1cxt9dcmpwz53fyzhfptakfws09nlqa9cmx3ndu 3000000mini --yes
./minid tx bank send alice mini19zngmq4fufx05sdn9gt9gd0dkjjy9e0gxq4yh5 3000000mini --yes

./minid tx bank send alice mini1x3945pyuesyep4a8fu0vjeanv6cn0h5gnt03gj 3000000mini --yes
./minid tx bank send alice mini1f4tev9wzfkt29dcpe0nfzak6rzuux45avcs7k7 3000000mini --yes
./minid tx bank send alice mini18kfmhgc3eplw2z3xhlz4vwezqc60p8gnu5339k 3000000mini --yes
./minid tx bank send alice mini1ygg8aw2x9u2fk4vetx3m2zjj66vm3gpmaxha7q 3000000mini --yes
./minid tx bank send alice mini1zxt2l9qdt6sxkxhcgpekkvwnsret273lwkaf6t 3000000mini --yes
./minid tx bank send alice mini15pz7z8v9kepd6rn805u773w9llllfx7tf03g3u 3000000mini --yes
./minid tx bank send alice mini1qe89gve4dxcamqk0m96uxqf6q76mnguckpkuk5 3000000mini --yes
./minid tx bank send alice mini1gefa64mj59a8l7la05dka8e5fmn04zplskk3rk 3000000mini --yes

./minid tx bank send alice mini1wd9aj6xlfqyqacw3fpsluwe2wwmd6sfjaqql7h 3000000mini --yes
./minid tx bank send alice mini1y3zvucu8pp24xzwcqr2r2nurh6d795f96zsftc 3000000mini --yes
./minid tx bank send alice mini1cjfytgrtj8kmu27mdu8e7pfc29e4609tk5seu8 3000000mini --yes
./minid tx bank send alice mini1atwg4gj2l6axq6eus26r7sg42u9dvsjuaudhmg 3000000mini --yes
./minid tx bank send alice mini1p8aa0cpt22fkmdugkh6d9f3u67h226pcz0q3qe 3000000mini --yes
./minid tx bank send alice mini1jwdwn6mz9rdyejvfeu7dlup4hs80mu5yx32qem 3000000mini --yes
./minid tx bank send alice mini1d0z4dq7a5xxqel776znr4cdcnk4kht003lvntd 3000000mini --yes
./minid tx bank send alice mini1pmlwxv4z6m3gvgm5zp0r44sw7gxafjz0u4av07 3000000mini --yes
minid query swt contract-state mini1jvkf9e7agxj8ly7mnxxmaq6cpq5e3hc266nx7p47exgd067xnadqlm3ken count "{}"

命令行测试并发:

minid tx swt execute mini1jvkf9e7agxj8ly7mnxxmaq6cpq5e3hc266nx7p47exgd067xnadqlm3ken increase_count "{\"increase\": \"10\"}" --from mywallet --gas 2000000 --yes
minid tx swt execute mini1jvkf9e7agxj8ly7mnxxmaq6cpq5e3hc266nx7p47exgd067xnadqlm3ken increase_count "{\"increase\": \"10\"}" --from client2 --gas 2000000 --yes

编译一个 AARCH64 REE 中的 wamr

cmake -DCMAKE_C_COMPILER=/root/optee/toolchains/aarch64/bin/aarch64-linux-gnu-gcc -DWAMR_BUILD_TARGET=AARCH64 ..

tps

var option = {
  tooltip: {
    trigger: 'axis'
  },
  xAxis: {
    type: 'category',
    name: 'Number of Clients',
    nameLocation: 'middle',
    nameGap: 25,
    data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32],
    nameTextStyle: {
      fontSize: 14,
      color: '#333333'
    }
  },
  yAxis: {
    type: 'value',
    name: 'Throughput [tx/s]',
    nameLocation: 'middle',
    nameRotate: 90,
    nameGap: 30,
    nameTextStyle: {
      fontSize: 14,
      color: '#333333'
    }
  },
  series: [
    {
      name: 'REE',
      type: 'line',
      smooth: true,
      data: [0.3066666666666666, 0.6066666666666667, 0.91, 1.23, 1.51, 1.8, 2.1133333333333333, 2.4033333333333333, 2.6766666666666667, 3.0, 3.316666666666667, 3.5733333333333333, 3.8733333333333335, 4.193333333333333, 4.51, 4.763333333333334, 5.066666666666666, 5.336666666666667, 5.613333333333333, 5.973333333333334, 6.18, 6.4, 6.81, 7.036666666666667, 7.14, 7.396666666666666, 7.81, 8.09, 8.366666666666667, 8.483333333333333, 8.683333333333334, 9.18]
    },
    {
      name: 'TEE',
      type: 'line',
      smooth: true,
      data: [0.3033333333333333, 0.58, 0.8766666666666667, 1.1733333333333331, 1.3833333333333333, 1.66, 1.9766666666666663, 2.2333333333333334, 2.333333333333333, 2.7266666666666666, 2.893333333333333, 3.0766666666666667, 3.46, 3.6233333333333335, 3.72, 3.813333333333333, 4.086666666666667, 4.333333333333333, 4.433333333333333, 4.71, 4.873333333333333, 5.02, 5.126666666666667, 5.0, 5.016666666666667, 5.13, 4.9, 5.046666666666667, 4.996666666666667, 5.153333333333333, 5.1066666666666665, 5.026666666666666]
    }
  ]
};

tx 延迟

var option = {
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow'
    }
  },
  xAxis: {
    data: [1, 2, 4, 8, 16, 32]
  },
  yAxis: {
   
  },
  series: [
    {
      name: 'REE',
      type: 'bar',
      data: [3.19159, 3.195985, 3.18846295392954, 3.255676615811373, 3.2775623512946117, 3.405997810457517],
      label: {
        show: true,
        position: 'top',
        formatter: function (params) {
          return params.value.toFixed(2);
        },
        textStyle: {
          color: '#333333'
        }
      }
    },
    {
      name: 'TEE',
      type: 'bar',
      data: [3.2055, 3.34902, 3.316692926136364, 3.493331343283582, 4.346150387453874, 6.369150669761274],
      label: {
        show: true,
        position: 'top',
        formatter: function (params) {
          return params.value.toFixed(2);
        },
        textStyle: {
          color: '#333333'
        }
      }
    }
  ]
};

query ps

var option = {
  tooltip: {
    trigger: 'axis'
  },
  xAxis: {
    
    data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
  },
  yAxis: {
    
  },
  series: [
    {
      name: 'REE',
      type: 'line',
      smooth: true,
      data: [9.05, 15.183333333333334, 17.25, 19.216666666666665, 21.183333333333334, 21.03333333333333, 21.25, 21.6, 21.5, 21.28333333333333, 22.216666666666665, 23.2, 23.266666666666666, 23.08333333333333, 22.95, 23.383333333333333, 23.166666666666668, 23.25, 23.15, 23.133333333333333, 23.0, 22.883333333333333, 23.48333333333333, 23.23333333333333, 23.1, 23.066666666666663, 23.383333333333333, 23.016666666666666, 23.15, 23.516666666666666, 23.3, 23.65],
      label: {
        show: false,
        position: 'top',
        formatter: function (params) {
          return params.value.toFixed(2);
        }
      }
    },
    {
      name: 'TEE',
      type: 'line',
      smooth: true,
      data: [6.633333333333334, 10.216666666666669, 10.3, 10.283333333333331, 10.35, 10.4, 10.483333333333333, 10.65, 10.75, 10.766666666666667, 10.766666666666667, 10.55, 10.583333333333334, 10.616666666666667, 10.7, 10.666666666666666, 10.766666666666667, 10.783333333333331, 10.766666666666667, 11.033333333333331, 11.066666666666666, 11.1, 11.15, 10.633333333333333, 10.75, 10.983333333333333, 10.733333333333333, 10.716666666666669, 10.766666666666667, 10.533333333333331, 11.083333333333334, 11.133333333333333],
      label: {
        show: false,
        position: 'top',
        formatter: function (params) {
          return params.value.toFixed(2);
        }
      }
    }
  ]
};

query 延迟

var option = {
  tooltip: {
    trigger: 'axis',
    axisPointer: { type: 'shadow' }
  },
  xAxis: {
    type: 'category',
    name: 'Number of Clients',
    nameLocation: 'middle',
    nameGap: 25,
    nameTextStyle: {
      fontSize: 14,  // 字体大小更大
      color: '#333333'  // 更深的颜色
    },
    data: [1, 2, 4, 8, 16, 32]
  },
  yAxis: {
    type: 'value',
    name: 'Average Latency (s)',
    nameLocation: 'middle',
    nameRotate: 90,
    nameGap: 30,
    nameTextStyle: {
      fontSize: 14,
      color: '#333333'
    }
  },
  series: [
    {
      name: 'REE',
      type: 'bar',
      data: [0.06019, 0.0815299012074643, 0.1581888464874241, 0.3210821604938271, 0.6368470064148254, 1.3139740521494012],
      label: {
        show: true,
        position: 'top',
        formatter: function (params) {
          return params.value.toFixed(2);
        },
        textStyle: {
          color: '#333333'
        }
      }
    },
    {
      name: 'TEE',
      type: 'bar',
      data: [0.10025, 0.1456397063621533, 0.3393615397082657, 0.7052192801251956, 1.467368390625, 2.8896027245508984],
      label: {
        show: true,
        position: 'top',
        formatter: function (params) {
          return params.value.toFixed(2);
        },
        textStyle: {
          color: '#333333'
        }
      }
    }
  ]
};

Query,TDR

TZ4FabricOur
10.500.27
20.590.33
40.590.46
80.610.51
160.670.54
320.790.53

TX,TDR

TZ4FabricOUR
10.460.01
20.620.04
40.610.05
80.610.07
160.680.24
320.790.45

QUERY,LIR

TZ4FabricOUR
11.630.67
21.700.79
41.521.15
81.751.2
163.181.3
324.921.2

TX,LIR

TZ4FabricOUR
11.480.01
21.480.05
41.540.04
81.880.07
163.460.33
325.110.87
var option = {
  tooltip: {
    trigger: 'axis',
    axisPointer: { type: 'shadow' }
  },
  legend: {
    data: ['Create DID', 'Query DID', 'Verify VC']
  },
  xAxis: {
    type: 'category',
    name: 'Number of Clients',
    nameLocation: 'middle',
    nameGap: 25,
    data: [1, 2, 4, 8, 16, 32]
  },
  yAxis: {
    type: 'log',
    logBase: 10,
    name: 'Average Latency (ms)',
    nameLocation: 'middle',
    nameRotate: 90,
    nameGap: 50
  },
  series: [
    {
      name: 'Create DID',
      type: 'bar',
      data: [3576.84, 3729.38, 4066.33, 4930.49, 10636.77, 15473.30],
      label: {
        show: false,
        position: 'top',
        formatter: function (params) {
          return params.value.toFixed(2);
        }
      }
    },
    {
      name: 'Query DID',
      type: 'bar',
      data: [268.04, 223.88, 554.75, 1153.51, 2402.07, 4921.97],
      label: {
        show: false,
        position: 'top',
        formatter: function (params) {
          return params.value.toFixed(2);
        }
      }
    },
    {
      name: 'Verify VC',
      type: 'bar',
      data: [5098.85, 7031.80, 10535.48, 19186.71, 35667.59, 71484.48],
      label: {
        show: false,
        position: 'top',
        formatter: function (params) {
          return params.value.toFixed(2);
        }
      }
    }
  ]
};