Skip to content

Feature/rate limit v2#19

Open
Tsuyoshi-Ishikawa wants to merge 49 commits intomasterfrom
feature/rateLimit_v2
Open

Feature/rate limit v2#19
Tsuyoshi-Ishikawa wants to merge 49 commits intomasterfrom
feature/rateLimit_v2

Conversation

@Tsuyoshi-Ishikawa
Copy link
Contributor

@Tsuyoshi-Ishikawa Tsuyoshi-Ishikawa commented Mar 9, 2023

Implementation Details

Enable to set multiple rate limits to a tx allow rule

// Before
export const getTxAllowList = (): Array<TransactionAllow> => {
  return [
    {
      fromList: ['*'],
      toList: ['*'],
      rateLimit: rateLimitA,
    },
  ];
};


// After
export const getTxAllowList = (): Array<TransactionAllow> => {
  return [
    {
      fromList: ['*'],
      toList: ['*'],
      rateLimits: [rateLimitA],
    },
  ];
};

Enable to set RDB(MySQL) as a new datastore

You can set RDB(MySQL) as a new datastore by setting process.env.RDB_URI.

Modify transaction rate limit logic

I have set the tx rate limit specification as follows.

  • minimize datastore access
  • never allow more transactions than the transaction rate limit to request verse.

details

https://dent-dessert-ab1.notion.site/rateLimit-722384feff3141ebb91dd5625151fd70

flow chart

The figure shows how the proxy operates to measure the rate limit.
https://app.diagrams.net/#G1My7_ucB1nDxTvaumkFFpXUYi75u8yJXr

Measurement Tests

I checked the following items with 1000 parallel requests.

  • tps
  • success times
  • failure times

https://docs.google.com/spreadsheets/d/1baxz73-_3TZAlG1ZILeCoogBpHV3l319uOr26MNuHLg/edit?usp=sharing

@Tsuyoshi-Ishikawa
Copy link
Contributor Author

Tsuyoshi-Ishikawa commented Sep 19, 2023

Modification

remove btree Index

f6d10f5

Enable to set postgres

80fe819

create redis client per request

5ad31db

commonalize code

cee16b7
70a689c

performance

I checked the following items with 1000 parallel requests.

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

Successfully merging this pull request may close these issues.

1 participant