openfaas / faas-netes

Serverless Functions For Kubernetes
https://www.openfaas.com
MIT License
2.12k stars 473 forks source link

Suggestion: add NATS Streaming maximum payload option to helm chart #734

Closed CarbonC closed 3 years ago

CarbonC commented 3 years ago

Sorry I took that long, here is the completed template:

It is impossible to modify NATS streaming maximum payload from the chart. In some use cases you might want to put it to more than the default 1Mb

Expected Behaviour

You should be able to pass a command line argument to increase the limit of NATS streaming payload

Current Behaviour

Being able to pass a value different than the default one of 1mb would allow nats to accept bigger chunks of data and forward them to openfaas functions correctly

Possible Solution

I implemented a solution that works very well on my stack on #735

Steps to Reproduce (for bugs)

If you want to see why its limiting, just increase nginx default payload limit, then send a payload of more than 1mb to an openfaas async function

Context

I'm using openfaas functions to treat some chunks of IOT data, that are mostly around a few hundred kb but some are a bit bigger, up to 5mb maybe.

Your Environment

Gateway uri: https://openfaas.getmoona.com version: 0.20.2 sha: 9bbb25e3c7c4cc5cd355edb3a122f8c7812e32db commit: Fix a bug that caused the services list to keep growing

Provider name: faas-netes orchestration: kubernetes version: 0.12.12 sha: 43f64cf9b30fd5f0f56514dee6b9fe01cfbfed45

alexellis commented 3 years ago

@CarbonC in order for us to consider your issue, you will need to provide a full and complete issue template, you haven't done that so could you take some time to improve this issue?

https://raw.githubusercontent.com/openfaas/faas-netes/master/.github/ISSUE_TEMPLATE.md

Alex

CarbonC commented 3 years ago

Sorry I took that long, here is the completed template:

It is impossible to modify NATS streaming maximum payload from the chart. In some use cases you might want to put it to more than the default 1Mb

Expected Behaviour

You should be able to pass a command line argument to increase the limit of NATS streaming payload

Current Behaviour

Being able to pass a value different than the default one of 1mb would allow nats to accept bigger chunks of data and forward them to openfaas functions correctly

Possible Solution

I implemented a solution that works very well on my stack on #735

Steps to Reproduce (for bugs)

If you want to see why its limiting, just increase nginx default payload limit, then send a payload of more than 1mb to an openfaas async function

Context

I'm using openfaas functions to treat some chunks of IOT data, that are mostly around a few hundred kb but some are a bit bigger, up to 5mb maybe.

Your Environment

Gateway uri: https://openfaas.getmoona.com version: 0.20.2 sha: 9bbb25e3c7c4cc5cd355edb3a122f8c7812e32db commit: Fix a bug that caused the services list to keep growing

Provider name: faas-netes orchestration: kubernetes version: 0.12.12 sha: 43f64cf9b30fd5f0f56514dee6b9fe01cfbfed45

CarbonC commented 3 years ago

@alexellis What could i do to help integrate the change in the repo? Looks like the issue is stale...

alexellis commented 3 years ago

We're sympathetic to the use-case, but if you look at your PR, you can see why we are reticent to merge a change like this. A user has already started putting 20MB messages into the NATS queue which it is not designed to support.

Large messages need to be offloaded to Minio / S3, which is trivial to do. Feel free to take a look into Minio usage and setup here -> https://github.com/alexellis/mqtt-to-s3

Alex

alexellis commented 3 years ago

To quote StackOverflow:

NATS does have a message size limitation that is enforced by the server and communicated to the client during connection setup. Currently, the limit is 1MB.

Specifically:

Messaging systems are not supposed to be used for file transfer. Use a distributed storage service to hold files and pass file ID in the message.

https://stackoverflow.com/questions/55368487/send-a-message-larger-than-1mb-using-nats-streaming#:~:text=NATS%20does%20have%20a%20message,file%20ID%20in%20the%20message.

There is a reason why AWS Lambda is also designed this way, with 6MB for synchronous and 128KB for async.

alexellis commented 3 years ago

FYI we have updated the docs to make this limit clearer. We discussed this as a group, and would suggest deploying your own separate NATS server and configuration, outside of the chart. We won't be able to give technical support for users who have increased this limit, and don't want to encourage it in any way by making it part of the upstream chart.

Happy to talk to users on Slack who need assistance dealing with large payloads, or understanding how to offload them to a database or S3 bucket for processing.

CarbonC commented 3 years ago

@alexellis Thanks for the update. I get your point. I still believe that my personal use case of up to 5mb is legit since the proportion of messages that weight more than 1mb is small. But obviously you can't let people send big files to nats and then have to provide support. I just wish there was a way to allow custom config files for every part of the chart with clear disclaimer that you wont support instead of just limiting the open source project to what you can support :/