-
Notifications
You must be signed in to change notification settings - Fork 86
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
Add limits to get records #87
base: master
Are you sure you want to change the base?
Conversation
Adding a test for this now. Early changes to check if the approach looks good. |
@mhart Request for a review. |
At first glance it looks... a bit odd? Like, Also, it would be good to have a test that is one byte under 5MB and one that is just one byte over – so both paths can be tested. |
Thank you very much for the response. Yes I agree it is good to have limited dependencies. But could not have a good way to calculate the size of an object without using object-sizeof(Nodejs noob here). The mathjs is pulled in to the dependencies for the pow function (I can remove that). I will add the tests and will request for a review soon. Thanks a lot for your time reviewing this. |
Ah, I see – yeah, JavaScript has a built-in global Math object, so In any case, I prefer Leave In terms of your If you address the tests, I can clean up the JS code as best I can. |
I added the tests as requested. I was also able to remove both the object and math dependencies. I am not sure if I am handling all the possible exception correctly or not. Do let me know if I can improve that. Also do i need to keep the package-lock consistent to the previous version? (I maybe using the newer libraries and ended up creating a new package-lock file). Also would it make sense for me to squash and create 1 single commit? |
@mhart Apologies for the delay in addressing code review comments. Request for review. |
@mhart Gentle remainder. |
@mhart Gentle remainder. |
@kailashhd I'm struggling to reproduce this on production – I'm just reading over the documentation now at https://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetRecords.html and it states "each shard can read up to 2 MiB per second" and "The maximum size of data that GetRecords can return is 10 MiB" So I'm not sure where the 5MiB figure came from? When I run your test (on production) it only retrieves one record, not five – I'm guessing that's because it's running into the 2MiB per second limit. |
@mhart Apologies. I must have used the limits from Put records: https://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecords.html instead of the value from the get-records. That's where the 5 MB comes from. So my tests should be returning 5 records (atleast that's what I am asserting) in 1 single response. It should not hit the 2 MB limit because put_records ensure that each record is a maximum of 1 MB. (Andin leveldb with kinesalite we don't change the records at all). That's the reason I have included other test will have a total of 15 records where it will be returned over 3 different responses. |
When you put those records into stream on Kinesis (I mean, on a real AWS Kinesis stream) – and then retrieve them with GetRecords – you're saying you get all five back? I only get one back. |
This was my test: 1) Created a bunch of records of size ~1 MB 2) Used the following aws CLI command to get shard iterator |
You need to try with |
Strangely even with the --no-paginate, I am still able to get all the 5 records at 1 go. I also tried to produce 5 additional records (total of 10 records) and did a get-records. Still got only 5 records (as I was close to the 10 MiB mark with 5 records). My aws version: aws-cli/1.16.70 Python/3.7.1 Darwin/17.7.0 botocore/1.12.60 |
Hmmm, strange – maybe it's an issue with the |
Ah yeah, that's the issue. Here's the return from the
|
Ha I did not realize that was the issue. The max 5MB request size for put records defined here: https://docs.aws.amazon.com/cli/latest/reference/kinesis/put-records.html works only if each shard gets a max of 1 MB per second. Since we are testing with 1 shard, this is causing problems. Let me try to make changes to the test to do sequential put_record instead of put_records tomorrow. Will also change it to be lessthan10Mb instead of 5MB. |
No description provided.