kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "" <yunbinw...@travelsky.com>
Subject Re: Re: why kafka producer api use cpu so high?
Date Sun, 11 May 2014 09:32:55 GMT
because my app can generate 50MB log every second and one record of log is about 1KB , so I
must send this log as fast as machine can.

this is very difficult,   on one hand  I want to send log as fast as possible,  on the other
hand  I want kafka producer api use cpu as low as possible.

if kafka api using cpu so high , it will impact my app.  

so can kafka solve this problem ? send 50MB log to kafka server every second ,and using low
cpu.





From: cacsar@gmail.com
Date: 2014-05-11 16:52
To: users
Subject: Re: why kafka producer api use cpu so high?
This code says to send this message infinitely as fast as the machine can
thereby consuming as much of one CPU as possible. You may want to consider
an alternate test, perhaps one that records the number of messages sent in
a given time period.

> >     public static void main(String[] args) {
> >         LogProducer producer = null;
> >         try{
> >             producer = new LogProducer();
> >             int i=0;
> >             while(true){
> >                 producer.send("test", "this is a
> sampleaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
> >             }
> >         }catch(Exception e){
> >             e.printStackTrace();
> >         }finally{
> >             if(producer != null){
> >                 producer.close();
> >             }
> >         }
> >
> >     }
> >
> > }
>
>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message