Spencer, here is the code for Mysql:
if do_insert:
cursor.execute("TRUNCATE TABLE keyvalue")
batch_size = 100
i = 0
start = time()
sql = "INSERT INTO keyvalue(`key`, value, author, text2, tags,
date) VALUES %s"
sql %= ",".join(["(%s, %s, %s, %s, %s, %s)"] * batch_size)
while i < keys:
to_insert = []
for j in range(batch_size):
to_insert += [i, 'Mary had a little lamb. ', 'Mike', 'My
First Blog Post!', 'mongodb, python', datetime.datetime(2009, 11, 12,
11,
14)]
i += 1
cursor.execute(sql, to_insert)
connection.commit()
i += batch_size
end = time()
print '%d documents inserted took %.2fs' % (keys, end - start)
Also here is the mongostat for the insert of 100.000 records.
python2.4 bench.py --keys 100000 --host 127.0.0.1 --gets 100 --focus
100 --do_insert
100000 documents inserted took 21.78s
100 gets (focussed on bottom 100%) took 0.09s
http://pastebin.com/RiR7ZsYK
Thank you guys for look at this!!
Wilmar
On May 15, 11:01 am, Spencer T Brody <
spen...@10gen.com> wrote:
> Can you try running mongostat for the duration of your test script and
> attach the output (using something like pastebin <
http://pastebin.com/>)?
> Can you also attach the script you're using to do the inserts to MySQL?
>
> On Tue, May 15, 2012 at 3:25 AM, Timothy Hawkins <
tim.hawk...@mac.com>wrote:
>
>
>
>
>
>
>
> > If the test algo is simple, it may be worth coding in another language
> > such as php, or javascript, to eliminate the language and driver as a
> > bottleneck you can install a php cli runtime and the mongo driver in most
> > linux distros with little effort, comparing results might be instructive,
> > javascript can be run directly by the mongo shell which already knows how
> > to talk to mongo.
>
> > Sent from my iPad
>
> > On 15 May 2012, at 15:16, Sam Millman <
sam.mill...@gmail.com> wrote:
>
> > So where did you move it from? And I take it the tmpfs is some sort of
> > other file system on another drive right?
>
> ...
>
> read more »