Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Single-threaded model vs multi-threaded model

Sumit Rawal answered on May 31, 2023 Popularity 8/10 Helpfulness 1/10

Contents


More Related Answers


Single-threaded model vs multi-threaded model

1

A typical single-threaded model could be: first, it retrieves records using the poll() method, and then it processing fetched records.

Because records are fetched and processed by the same thread, they are processed in the same order as they were written to the partition. This ensures the processing order guarantees.

For example, in AWS Kinesis with Lambda architecture, you can change the batch size which controls the maximum number of records that can be sent to your Lambda function with each invoke.

increase the Lambda batch size will increase throughput

Multithreading is “the ability of a central processing unit (CPU) (or a single core in a multi-core processor) to provide multiple threads of execution concurrently, supported by the operating system.” In situations where the work can be divided into smaller units, which can be run in parallel, without negative effects on data consistency, multithreading can be used to improve application performance.

a multi-threaded model

A multi-threaded model may be processing each message in a separate thread taken from a thread pool, while using automatic offset commits. However, a Multi-threaded model may cause some undesirable effects:

Offset might be committed before a record is processed by consumers

Message processing order can’t be guaranteed since messages from the same partition could be processed in parallel

Multi-threaded model is useful when the other system can accept such high load and when there is no dependency on the order of processing.

Popularity 8/10 Helpfulness 1/10 Language whatever
Source: Grepper
Link to this answer
Share Copy Link
Contributed on May 31 2023
Sumit Rawal
0 Answers  Avg Quality 2/10


X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
X
Grepper Account Login Required

Oops, You will need to install Grepper and log-in to perform this action.