Back

How to make a collection which was created by a user , accessible only to him

  • 0
  • Web
Binyamin
3 Apr, 2023, 23:29

That's actually a very good question

TL;DR
User is asking for help on making a collection accessible only to the user who created it. There is no solution provided in the support thread.
Binyamin
3 Apr, 2023, 23:30

If the function is run through the worker it seems that is going to work in FIFO style I'm still looking into it

Let's see if we get any official answer

Drake
3 Apr, 2023, 23:43

yes, you are correct. At the moment, each worker handles events serially. we're planning on releasing a proxy layer in front that can make it easier to scale

Drake
3 Apr, 2023, 23:43

actually...you can already scale by adding additional workers...it's just that the executor might be limitied...

Binyamin
3 Apr, 2023, 23:44

So for now if let's someone is execution function from the client SDKs then it will also execute only serial mode?

Binyamin
3 Apr, 2023, 23:45

So that mean in order to create more dynamic open-runtime instances we need to add more executor workers? That make sense

Drake
3 Apr, 2023, 23:45

only queued executions execute serially. synchronous executions execute concurrently (createExecution(async = false))

Binyamin
3 Apr, 2023, 23:45

But I didn't see any option to scale up for direct function execution

Binyamin
3 Apr, 2023, 23:46

I've tried and never was able to pass the 10 concurrently functions call at given time

After that the functions runtime crash for a minute before it can run again, look like some bottle neck. The function it self is a very simple. Takes usually > 300ms to execute.

Tested on a 4GB RAM & 2 vCPU server with no limit on function container creation

Is that mean that the only option is scale the Appwrite main container?

punti_z
3 Apr, 2023, 23:54

Hey @Steven Can't say I follow the whole conversation. Can you explain queues and synchronous executions and what, if anything, can i do to minimize the impact of this serial execution

punti_z
3 Apr, 2023, 23:56

Also any details you can share as to when this limitation might get looked into ?

punti_z
4 Apr, 2023, 00:07

A workaround I can imagine is to deploy the same function multiple times and have a master function distribute work and assign it to idle function

Binyamin
4 Apr, 2023, 00:09

That's sound a bit a trouble And if you're using Docker Swarm to deploy Appwrite as service stack then you can scale the number of the appwrite-worker-functions and then as I understood more container will be create with the same function and will disturbed across all the Docker Swarm machines

Drake
4 Apr, 2023, 00:09

how many cores? i think the executor can only handle a handful of concurrent requests per core.

Binyamin
4 Apr, 2023, 00:09

2

Drake
4 Apr, 2023, 00:11

functions are either executed asynchronously or synchronously. If createExecution() is called with async = false, then the execution is synchronous (see https://appwrite.io/docs/client/functions?sdk=web-default#functionsCreateExecution). any other method is asynchronous, including cron and events

Binyamin
4 Apr, 2023, 00:11

So scaling the appwrite: container will results more function being create?

And

Is there a way to run them 5-10 at time and the rest will be queued like PHP-FPM? I've just tested one of my published laravel SaaS and on server that cost 5 bucks it was able to handle 250 requests in 5 seconds

Binyamin
4 Apr, 2023, 00:12

I mean that's make sense but it means that the second the app is getting a bit bigger then it will required immediate scaling

Drake
4 Apr, 2023, 00:12

how exactly are you executing the functions?

Binyamin
4 Apr, 2023, 00:15

In this case I've just run test of project I have This is the code

TypeScript
const functionRes = await functions.createExecution('[ID]', slug.toString());

I've benchmarked it in the simple way available,

  1. I've disabled the rate limits protector
  2. opened 50 tabs of the same window Then...

I've also tried within loop etc,

If I await between the function meaning creating "queue" then all the function will execute in < 300ms each But the second I run them together, then after 5 I lose the function for at least 1 minute

Binyamin
4 Apr, 2023, 00:21

I will open new support topic for it

Drake
4 Apr, 2023, 00:31

lose the function for a minute? because the function takes time to execute?

Binyamin
4 Apr, 2023, 00:32

Yes after few execution (5-10) each function takes much longer to execute.

joeyouss
24 Apr, 2023, 08:48

Hi - @Berserker , do you need any more help here?

Berserker
25 Apr, 2023, 00:28

@joeyouss i think I'm done thanks for the support :appwritepeepo:

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more