this is the Redis fragmentation context :)
The winner is the first to post in this thread (accordingly to google
group web interface message date) a simple script that can lead to
fragmentation.
The prize is a Redis shirt with the new logo and the tagline "all the
allocations are belong to me".
Rules:
- The program must be 200 lines of code or less
- The program must be written in Ruby, Python, Perl, Tcl, or C, using
just your preferred Redis library as dependency (together with any
other code lib of the used language).
- The program must show to be able to fragment memory. This means once
run, after at max 1 hours the peak memory usage must be reached (as
reported by INFO used memory field), but the RSS will start to grow.
In Redis 2.2 this will be very evident as the fragmentation_ratio
field of INFO will start to grow more and more.
- The RSS grow should continue for at least 24 hours since the first
time the program is executed.
- The fragmentation should be evident running the program against a
Linux system with standard libc malloc OR against mac os x snow
leopard with the default malloc implementation. No need to test the
program in both the architectures as long as you are able to fragment
memory with one OS.
- The winner will be the first poster that will provide a program able
to fragment Redis memory. Even if another program will be the first to
be *verified* to work, the winner will be the first program that was
posted and actually works.
This is an example problem that DOES NOT produce fragmentation, just
as an example:
require 'rubygems'
require 'redis'
r = Redis.new
while true
puts "."
zsetname = "zset-#{rand(100)}"
1000.times {
r.zadd(zsetname,rand(),rand(1000))
r.setex(rand(1000000000),60,".")
}
zsetname = "zset-#{rand(100)}"
r.del zsetname
end
Cheers,
Salvatore
--
Salvatore 'antirez' Sanfilippo
open source developer - VMware
http://invece.org
"We are what we repeatedly do. Excellence, therefore, is not an act,
but a habit." -- Aristotele
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
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.
the goal is not to block Redis :) But to fragment memory, that is very
different ;)
Cheers,
Salvatore
require 'redis'
$redis = Redis.new
def random_id
rand(10000000)
end
def store(id)
now = Time.now.to_i
$redis.zremrangebyscore('online', -1 * (now - 60), 0)
$redis.zadd('online', -1 * now, id)
end
pool = Array.new(1000).map { random_id }
count = 0
loop do
index = rand(pool.size)
if rand(200) == 0
pool[index] = random_id
else
store(pool[index])
end
count += 1
puts "#{$redis.zcard('online')}" if count % 1000 == 0
end
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> 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.
>
Hello Albert!
I tested briefly every implementation submitted, but just for a few
minutes, without fragmentation,
but before to declare every entry not good I want to test each one for
longer time in the course of this week.
So stay tuned ;)
Cheers,
Salvatore
> Cheers,
> Albert
>
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> 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.
>
>
--
--
--pau