-
Notifications
You must be signed in to change notification settings - Fork 4
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
Save 75% of platform message size 🤦🏻♂️ #80
Comments
All sailor versions need to be updated at the same time. :( |
@zubairov @jhorbulyk either I did not understand the problem, but I think we can make it backward compatible. It is a little bit stinky, but should work. So, if you want to have a possibility to exchange both base64 or Buffer, you can predict the format of the message you got. Pseudo-code function decryptIV(encData, options) {
const isBase64 = Buffer.from(encData, 'base64').toString('base64') === encData;
const inputFormat = isBase64 ? 'base64' : 'buffer';
const result = cipher.update(encData, inputFormat, 'utf-8') + cipher.final('utf-8');
return result;
} The idea behind this trick is simple:
Now, regard to compatibility: New sailor versions in Old sailor versions in Another case, when message is sent from old to new sailor: Old Hope I'm right about the problem you saying |
@ghaiklor ok, what happens when "new" version send a message in |
@zubairov dope, I didn't think about this one, shame on me 😆 We could ignore this issue for now and just increase the limits for pods where sailor is running, but... it is a short-term solution. |
It's not really a |
RabbitMQ has no issues with handling big messages. What do you mean by that ? |
Yes, correct, my statement should be - we produce unnecessary load on RabbitMQ due to sailor implementation details |
I'm going to think about any other possible solutions for problem with huge messages, but for now we have the following facts:
For now, I do not see any ways to solve it without touching sailor (expect increasing memory limits). |
@ghaiklor I don't think it's the solution for huge messages, only a minor efficiency gain, not more than that. |
This place here returns a string with base64 encoded string in it. Base64 binary is roughly 75% larger than binary data. The
publish
method that sends data to the queue accepts a binaryBuffer
so it makes little sense to send a based64 string over it.BTW
publish
method copies the data, so data copied 3 times - here, here when new Buffer is created and here when data is published to the queueThe main problem here when fixing it - maintain backwards compatibility.
The text was updated successfully, but these errors were encountered: