--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/o_Y7z6CSEz0J.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.
To unsubscribe from this group, send email to redis-db+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/bG5DZf9aPZIJ.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
You are not piplining anything:
pl = rr.pipeline(transaction=False)
for f in fields:
rr.hincrby("%s:%s" % (key, f), samp[f], data)
cc = cc + 1
pl.execute()
You should be using pl.hincrby()
Regards,
- Josiah
On Tue, Jun 12, 2012 at 10:50 AM, Matt Keranen wrote:
> Using a contrived example at https://gist.github.com/2914601 , I am seeing a
> performance bottleneck in the Python driver (redis-py), where the script
> takes about 90 seconds to load a 150MB csv file.
>
> On my test system, executing the script without calling HINCRBY on the Redis
> server, I get a 5 second runtime when simply parsing csv files and creating
> the key and increment values. Profiling the script confirms that most of the
> execution time is within the driver. Widening the pipeline set has minimal
> impact.
>
> In cases such as this, does is make sense to call to a C module to write to
> Redis via the C driver, or perhaps write the process in a faster / compiled
> language entirely? I am working under the assumption that drivers for
> "faster" languages will run faster.
>
> Or is there a flaw in my approach, that would
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/redis-db/-/o_Y7z6CSEz0J.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to
If you're that concerned with performance you can always write out the
protocol formatted commands to a file, and then run that file directly
against Redis.
Also see the --pipe option to redis-cli in 2.6.
Cheers,
Pieter
>> For more options, visit this group at
>> http://groups.google.com/group/redis-db?hl=en.
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/redis-db/-/bG5DZf9aPZIJ.
>
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to
How many items are you updating at once per pipeline execute() call?
From your numbers, it would seem it is only roughly 2-3 per. Try this
one, which will only run execute once every 256 lines:
https://gist.github.com/2919174
- Josiah
>> > For more options, visit this group at
>> > http://groups.google.com/group/redis-db?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/redis-db/-/4p5385Tk5GIJ.
>
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to
To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/f0w5ME93QKUJ.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/p0Kqb8Q6ZkEJ.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
that's roughly 11M increments. not sure what machine this is but on my machine redis benchmark with highly optimized C code can do about 170k increments/sec. that's 58 seconds for 11M increments. so maybe this is just too much for a single redis instance. how much does your machine do in redis-benchmark?
also, are you using the hiredis python module as an accelerator to redis-py? if not, just "sudo easy_install hiredis", it increases throughput considerably.
To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/PZ5DqDAnRZcJ.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/PZ5DqDAnRZcJ.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
I forgot to pipeline my benchmark, so now with piping every 1000 INCRs, I'm getting
INCR: 729927.06 requests per secondwhich should be enough to do what you want in 15-16 seconds, so even if your machine is 50% slower than mine as it appears from your data, you should be able to do this in 30 seconds. of course longer keys can make it much slower but you should still be fine.just out of curiosity, did you try doing it all in one process and one pipeline? this should be close to what C can do.
To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/r06xotUM_KAJ.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
That was one of the changes I made in the forked version I sent
earlier. It shouldn't matter significantly, but every little bit
counts. Incidentally, the script as posted shouldn't run, as there is
a NameError due to the samp[f] reference; samp isn't defined in the
code.
pl.hincrby("%s:%s" % (key, f), samp[f], data)
- Josiah
>>>>>> >> > redis-db+unsubscribe@googlegroups.com.
>>>>>> >> > For more options, visit this group at
>>>>>> >> > http://groups.google.com/group/redis-db?hl=en.
>>>>>> >
>>>>>> > --
>>>>>> > You received this message because you are subscribed to the Google
>>>>>> > Groups
>>>>>> > "Redis DB" group.
>>>>>> > To view this discussion on the web visit
>>>>>> > https://groups.google.com/d/msg/redis-db/-/4p5385Tk5GIJ.
>>>>>> >
>>>>>> > To post to this group, send email to redi...@googlegroups.com.
>>>>>> > To unsubscribe from this group, send email to
>>>>>> > redis-db+unsubscribe@googlegroups.com.
>>>>>> > For more options, visit this group at
>>>>>> > http://groups.google.com/group/redis-db?hl=en.
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Redis DB" group.
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msg/redis-db/-/f0w5ME93QKUJ.
>>>>>> To post to this group, send email to redi...@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to
>>>>>> redis-db+unsubscribe@googlegroups.com.
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/redis-db?hl=en.
>>>>>>
>>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Redis DB" group.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msg/redis-db/-/p0Kqb8Q6ZkEJ.
>>>>>
>>>>> To post to this group, send email to redi...@googlegroups.com.
>>>>> To unsubscribe from this group, send email to
>>>>> redis-db+unsubscribe@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/redis-db?hl=en.
>>>>
>>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Redis DB" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/redis-db/-/PZ5DqDAnRZcJ.
>>>
>>> To post to this group, send email to redi...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> redis-db+unsubscribe@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/redis-db?hl=en.
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/redis-db/-/r06xotUM_KAJ.
>
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to
> redis-db+unsubscribe@googlegroups.com.
You are only executing the transaction once at the end of each chunk,
not occasionally as I showed with my gist (which I deleted before
checking yours). Try sending somewhere between 500 and 10k hincrby
calls per pipeline.execute(). I'm suspect that your peak performance
will be somewhere in that range.
Regards,
- Josiah
>> >>>>>> >> > redis-db+unsubscribe@googlegroups.com.
>> >>>>>> >> > For more options, visit this group at
>> >>>>>> >> > http://groups.google.com/group/redis-db?hl=en.
>> >>>>>> >
>> >>>>>> > --
>> >>>>>> > You received this message because you are subscribed to the
>> >>>>>> > Groups
>> >>>>>> > "Redis DB" group.
>> >>>>>> > To view this discussion on the web visit
>> >>>>>> > https://groups.google.com/d/msg/redis-db/-/4p5385Tk5GIJ.
>> >>>>>> >
>> >>>>>> > To post to this group, send email to redi...@googlegroups.com.
>> >>>>>> > To unsubscribe from this group, send email to
>> >>>>>> > redis-db+unsubscribe@googlegroups.com.
>> >>>>>> > For more options, visit this group at
>> >>>>>> > http://groups.google.com/group/redis-db?hl=en.
>> >>>>>>
>> >>>>>> --
>> >>>>>> You received this message because you are subscribed to the Google
>> >>>>>> Groups "Redis DB" group.
>> >>>>>> To view this discussion on the web visit
>> >>>>>> https://groups.google.com/d/msg/redis-db/-/f0w5ME93QKUJ.
>> >>>>>> To post to this group, send email to redi...@googlegroups.com.
>> >>>>>> To unsubscribe from this group, send email to
>> >>>>>> redis-db+unsubscribe@googlegroups.com.
>> >>>>>> For more options, visit this group at
>> >>>>>> http://groups.google.com/group/redis-db?hl=en.
>> >>>>>>
>> >>>>>>
>> >>>>> --
>> >>>>> You received this message because you are subscribed to the Google
>> >>>>> Groups "Redis DB" group.
>> >>>>> To view this discussion on the web visit
>> >>>>> https://groups.google.com/d/msg/redis-db/-/p0Kqb8Q6ZkEJ.
>> >>>>>
>> >>>>> To post to this group, send email to redi...@googlegroups.com.
>> >>>>> To unsubscribe from this group, send email to
>> >>>>> redis-db+unsubscribe@googlegroups.com.
>> >>>>> For more options, visit this group at
>> >>>>> http://groups.google.com/group/redis-db?hl=en.
>> >>>>
>> >>>>
>> >>> --
>> >>> You received this message because you are subscribed to the Google
>> >>> Groups
>> >>> "Redis DB" group.
>> >>> To view this discussion on the web visit
>> >>> https://groups.google.com/d/msg/redis-db/-/PZ5DqDAnRZcJ.
>> >>>
>> >>> To post to this group, send email to redi...@googlegroups.com.
>> >>> To unsubscribe from this group, send email to
>> >>> For more options, visit this group at
>> >>> http://groups.google.com/group/redis-db?hl=en.
>> >>
>> >>
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Redis DB" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/redis-db/-/r06xotUM_KAJ.
>> >
>> > To post to this group, send email to redi...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > For more options, visit this group at
>> > http://groups.google.com/group/redis-db?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/redis-db/-/uCh44arTVbwJ.
>
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to