Hi
I've noticed the performance of both the IssueFrom and Publish calls degrade significantly as the number of assets on the chain grows, even at relatively small numbers.
I found that the first issue command took 4ms, but the 10,000th issuance took over 100ms
My setup is a Node JS app and chain(single node) spun up with docker-compose.
Multichain version is 1.0.5.
I have been using the multichain-node library but also tried my own code to directly talk to the chain. There wasn't much performance difference (my own code was actually a bit slower).
Apologies for the code snippet below but is there something I'm doing wrong? Any help would be appreciated.
async function issue(counter) {
const assetId = uuid.v4().replace(/-/g, '');
const metadata = {
streamId: `streamId-${counter}`,
cData: `c-${counter}`,
lData: `l-${counter}`,
sData: `s-${counter}`,
mData: `m-${counter}`,
dateCreated: new Date().toString(),
};
const body = JSON.stringify({ jsonrpc: '1.0', id: 'curltest', method: 'issuefrom', params: [MY_ADDRESS, MY_ADDRESS, assetId, 1, 1, 0, metadata] });
const url = `http://${multichainHost}:8571`;
const options = {
url,
method: 'POST',
headers:
{
'content-type': 'text/plain',
},
auth: {
user: 'user',
pass: `${multichainPassword}`,
},
body,
};
const start = now();
const response = await rp(options);
const end = now();
const duration = (end - start).toFixed(1);
console.log(`${counter}, ${duration}`);
return response.body;
}
async function directTest() {
const nToCreate = 10000;
for (let i = 0; i < nToCreate; i += 1) {
await issue(i);
}
}