Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define scalable Social DB traffic and integrate it into the load generator / test runner #9095

Closed
4 of 6 tasks
Tracked by #8999
jakmeier opened this issue May 23, 2023 · 5 comments
Closed
4 of 6 tasks
Tracked by #8999

Comments

@jakmeier
Copy link
Contributor

jakmeier commented May 23, 2023

We are now using locust to create the TPS benchmark described in #8999.

This issue is to track how we integrate SocialDB traffic.

  • Initialize SocialDB
  • Initialize user accounts from each worker runner
  • Follow other created accounts
  • Submit posts
  • Like posts (descoped 18 July)
  • (nice to have) Attach frontend to view traffic
@jakmeier
Copy link
Contributor Author

High-level definition of Social DB workload

Initialization of SocialDB is quite straight forward:

  1. Deploy WASM (Available on github: https://github.com/NearSocial/social-db/tree/aa7fafaac92a7dd267993d6c210246420a561370/res)
  2. Call new()
  3. Call set_status(status = "Live")

Then to register a user, we don't have to do anything. But for every call we do later, we must ensure there is enough storage. To facilitate, user initialization can be as easy as:

  1. Call storage_deposit(account_id = "user.near")

For actual workload, I am thinking of three different interactions to starts:

  • Follow someone else
  • Post a message
  • Like a post from someone else

All of these interactions are just calls to set. The only non-trivial part is constructing the argument just right.
This can also be easily extended to all kinds of interactions that change social DB, such as widget updates, profile changes, etc. It's all just set calls.

The argument construction requires nested JSON serialization as shown below. Luckily, it can be done in just a few lines of Python code.

// Example JSON for "jakmeier.near" following "pugachag.near"
{
  "data": {
    "jakmeier.near": {
      "graph": {
        "follow": {
          "pugachag.near": ""
        }
      },
      "index": {
        "graph": "{\"key\":\"follow\",\"value\":{\"type\":\"follow\",\"accountId\":\"pugachag.near\"}}",
        "notify": "{\"key\":\"pugachag.near\",\"value\":{\"type\":\"follow\"}}"
      }
    }
  }
}

See the full call in the explorer: https://explorer.near.org/transactions/J2erddvLFo8L4Qn9Rb4HV8tHA3iJtNcgW6iSDBRwCcBh

@jakmeier
Copy link
Contributor Author

So far I code the initialization and the follow transactions. It's available in this commit: dbef2f0

@jakmeier
Copy link
Contributor Author

jakmeier commented Jun 6, 2023

We merged #9133 with initialization, "Follow someone else" and "Post a message".

@jakmeier
Copy link
Contributor Author

jakmeier commented Jun 6, 2023

One inconvenience so far is that the smart contract validation might not be enough for us to be sure that meaningful work is being done. A set call may be successful without actually having the desired effect.

Ideally we would attach a frontend to benchmarking and look at users and posts from there, even if just to confirm that it does what it should. But I will keep this as a nice-to-have addition for now.

@jakmeier
Copy link
Contributor Author

I'm going to close this as there is currently no plan to add likes or a frontend. The current socialDB load is good enough for, as it can be used to test how many users we can support in a given setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant