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

Feature/rate limit v2 #19

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open

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