Non-Transaction Write is not allowing the configuration of max parallelization
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 38/100
Línea de trabajo
Comienza con src/main/java/dev/openfga/sdk/api/configuration/ClientWriteOptions.java y la ruta de escritura no transaccional alrededor de OpenFgaClient.java, líneas 415-417. Compara la configuración y los valores predeterminados de Java con las implementaciones de referencia en Go, JS y .NET; se considera terminado cuando maxParallelRequests se pueda configurar y el tamaño del bloque de la transacción use el valor predeterminado previsto sin cambiar el comportamiento de escritura existente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Please do not report security vulnerabilities here. See the Responsible Disclosure Program.
Thank you in advance for helping us to improve this library! Please read through the template below and answer all relevant questions. Your additional work here is greatly appreciated and will help us respond as quickly as possible.
By submitting an issue to this repository, you agree to the terms within the OpenFGA Code of Conduct.
Description
Provide a clear and concise description of the issue, including what you expected to happen.
The Java SDK ClientWriteOptions https://github.com/openfga/java-sdk/blob/main/src/main/java/dev/openfga/sdk/api/configuration/ClientWriteOptions.java#L17 do not expose a method to set the parallization for non-transactional writes.
Equivalent JS interface: https://github.com/openfga/js-sdk/blob/main/client.ts#L190-L196
Equivalent .NET interface: https://github.com/openfga/dotnet-sdk/blob/main/src/OpenFga.Sdk/Client/Model/ClientWriteOptions.cs#L53
Equivalent Go interface: https://github.com/openfga/go-sdk/blob/main/client/client.go#L1416-L1429
The maxParallelRequests is supposed to define how many requests are sent in paralllel.
When your application sends multiple non-transactional write requests (let's say you send N of them), the SDK doesn't send them all individually. Instead, it groups them into smaller batches and sends these batches with a controlled amount of parallelization.
Here's how it should work:
-
Batching Requests:
- The SDK first divides your N requests into M "chunks" or batches.
- The size of each chunk is determined by the transaction chunk size, which defaults to 1 request per chunk.
- So, if you have 100 requests and the default chunk size is 1, you'll end up with 100 individual chunks (M = 100 / 1 = 100).
- The formula for calculating M is: $M = \text{integer}(\text{N / transaction chunk size} + 1)$. The "+1" ensures that any remainder requests also get their own chunk.
-
Limited Parallel Processing (Worker Queue):
- Once the requests are batched, the SDK sends them out with limited parallelization. This means it doesn't try to send all M chunks at once.
- It only allows a maximum number of requests to be active (in progress) at any given time. This limit is called maxParallelRequests, and it defaults to 10.
- Think of it like a worker queue:
- The SDK starts by sending out up to 10 requests simultaneously (if M is 10 or more).
- As soon as any of those active requests finishes, the SDK immediately sends out the next request from the queue. It doesn't wait for all 10 active requests to complete before sending more. This keeps the processing flow continuous and efficient.
- Note: that this queue is per-Write request, so we're not queuing all the requests in the SDK.
In essence, the SDK intelligently batches your non-transactional writes and processes them in a controlled, concurrent manner to optimize performance without overwhelming the system.
Alt SDK implementations of the feature:
- Go: https://github.com/openfga/go-sdk/blob/main/client/client.go#L1661-L1720
- JS: https://github.com/openfga/js-sdk/blob/main/client.ts#L520-L560
- .NET: https://github.com/openfga/dotnet-sdk/blob/main/src/OpenFga.Sdk/Client/Client.cs#L226-L282
Additionally, the Java SDK seems to be using the DEFAULT_MAX_METHOD_PARALLEL_REQS for the transaction chunksize, confusing the two: https://github.com/openfga/java-sdk/blob/main/src/main/java/dev/openfga/sdk/api/client/OpenFgaClient.java#L415-L417. Max chunk size should default to 1 if not set: https://github.com/openfga/dotnet-sdk/blob/main/src/OpenFga.Sdk/Client/Client.cs#L195-L197
Version of SDK
v0.8.3
Version of OpenFGA (if known)
N/A
OpenFGA Flags/Custom Configuration Applicable
N/A
Reproduction
Detail the steps taken to reproduce this error, what was expected, and whether this issue can be reproduced consistently or if it is intermittent.
- Initialize OpenFgaClient with openfga_sdk.ClientConfiguration parameter api_host=127.0.0.1, credentials method client_credentials
- Invoke method read_authorization_models
- See exception thrown
Sample Code the Produces Issues
Backtrace (if applicable)
Expected behavior
When Write is called in non-transaction mode, the SDK should
Additional context
- Lenguaje dominante
- Java
- Estrellas
- 55
- Forks
- 26
- Merge medio
- 1 d 22 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de openfga/java-sdk
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Make client-credentials token refresh buffer and jitter configurablePosiblemente ocupada @dpkass la tomó hace 30 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
openfga/java-sdk#370 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
openfga/java-sdk#361 · 1 reacción ·
Los mantenedores suelen responder en 1 día
Todos los issues de openfga/java-sdk
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
utopia-rise/godot-jvm#1004 ·
Los mantenedores suelen responder en 1 día
-
Expose numberOfPermits in RateLimiterEvent.toString() and the ratelimiterevents actuator DTOAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
resilience4j/resilience4j#2547 ·
Los mantenedores suelen responder en 9 días
-
Clock.MakeDate continues execution and returns a rolled-over instant after dispatching error on invalid datePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
mit-cml/appinventor-sources#4155 ·
Los mantenedores suelen responder en 1 día
-
[Doc] - Creation du READMEAbierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 62/100
Hira-shi/PW1-DAI-Carrel-Egal-Eyer#28 ·
Los mantenedores suelen responder en 1 día
-
`GET /v1/event/token/{uuid}` can report a BOM upload as done before policy evaluation and metrics have finishedPosiblemente ocupada @Zargath la tomó hoy. Abiertodefect in triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
DependencyTrack/dependency-track#7646 ·
Los mantenedores suelen responder en 1 día