GitHub user asafm added a comment to the discussion: Pulsar Functions lifecycle and depolyment details.
I'm not a function expert, but I can contribute a bit of my knowledge in here. > IIUIC, I have the option (among other) to run my functions (trusted) inside > the same JVM as the Pulsar Broker itself, by choosing "Run function workers > with brokers" and the "thread runtime". And if I want to run on the same VM > as the broker, but in separate OS process, I simply follow "process runtime". > Is that correct? I don't need K8s to run functions (I have not set up K8s)? Process runtime will launch a process per function instance. For example, if you specified a function to have 3 instances, 3 process would be launched. Function Worker role (even when run inside Pulsar VM) - you can have many of them. One of them would be the leader and scheduler - meaning it will instruct which of the instances should run each function instance. If this is a production environment, it seems better to separate Function Worker and Broker to separate machines. > Lifecycle of functions is very unclear to me. > a. How many instances are created? > b. One per request? > c. One per key? > d. Are instances pooled? > e. Do the functions need to be thread-safe? > f. Can I control it? > When you deploy or update a function using REST or admin CLI, you can specify how many instances you want per each function. Each instance runs in its own Thread/Process/Pod depending on the runtime. Not per request/key. Not sure about the pooling question. Can you elaborate? Regarding thread safety, I guess only if you share variables, but you shouldn't. > When deploying with "pulsar-admin functions create", do I need to > do that on each broker instance, or just once? What happens if my > Ansible tries to do that in parallel on all instances? > > >From my understanding, Pulsar has a storage area where the function metadata >and the JAR/NAR are stored. You should deploy to Pulsar a function only once. > b. I assume that "pulsar-admin functions update" will let all > functions complete before killing the thread/process. Right? > Compete on what? GitHub link: https://github.com/apache/pulsar/discussions/20195#discussioncomment-5766122 ---- This is an automatically sent email for commits@pulsar.apache.org. To unsubscribe, please send an email to: commits-unsubscr...@pulsar.apache.org