Non-Transaction Write is not allowing the configuration of max parallelization
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 38/100
Rechercherichtung
Beginne mit src/main/java/dev/openfga/sdk/api/configuration/ClientWriteOptions.java und dem nicht-transaktionalen Schreibpfad rund um OpenFgaClient.java in den Zeilen 415-417. Vergleiche die Java-Konfiguration und die Standardwerte mit den referenzierten Implementierungen in Go, JS und .NET; abgeschlossen ist die Arbeit, wenn maxParallelRequests konfiguriert werden kann und die Transaktions-Chunk-Größe den vorgesehenen Standardwert verwendet, ohne das bestehende Schreibverhalten zu ändern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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
- Vorherrschende Sprache
- Java
- Sterne
- 55
- Forks
- 26
- Ø Merge
- 4 T. 3 Std.
- Gemergte PRs (30 T.)
- 8
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus openfga/java-sdk
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
-
Make client-credentials token refresh buffer and jitter configurableEvtl. vergeben @dpkass hat das vor 37 Tagen übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 72/100
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
Alle Issues in openfga/java-sdk
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
PhasetransCrystal/FPSMatch#47 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 76/100
apache/maven-toolchains-plugin#205 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug] Dated CSV export filenames use the UTC day rather than the operator dayEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
apache/rocketmq-dashboard#6896 ·
Maintainer antworten meist innerhalb von 3 Tagen