Archive for the 'YouTellMe' Category

Django query set iterator – for really large, querysets

When you try to iterate over a query set with about 0.5 million items (a few hundred megs of db storage), the memory usage can become somewhat problematic. Adding .iterator to your query set helps somewhat, but still loads the entire query result into memory. Cronjobs at YouTellMe.nl where unfortunately starting to fail. My colleague Rick came up with the following fix.

This solution chunks up the querying in bits of 1000 (by default). While this is somewhat heavier on your database (multiple queries) it seriously reduces the memory usage. Curious to hear how other django developers have worked around this problem.

import gc

def queryset_iterator(queryset, chunksize=1000):
    '''
    Iterate over a Django Queryset ordered by the primary key

    This method loads a maximum of chunksize (default: 1000) rows in it's
    memory at the same time while django normally would load all rows in it's
    memory. Using the iterator() method only causes it to not preload all the
    classes.

    Note that the implementation of the iterator does not support ordered query sets.
    '''
    pk = 0
    last_pk = queryset.order_by('-pk')[0].pk
    queryset = queryset.order_by('pk')
    while pk < last_pk:
        for row in queryset.filter(pk__gt=pk)[:chunksize]:
            pk = row.pk
            yield row
        gc.collect()

#Some Examples:
#old
MyItem.objects.all()

#better
MyItem.objects.all().iterator()

#even better
queryset_iterator(MyItem.objects.all())

Django snippet here.

Django & Python & Web Development & YouTellMe tschellenbach 03 Mar 2010 6 Comments

YTM launch!!

No more beta for YouTellMe.nl
The website which is taking over the Dutch product comparison market is officially going out of beta @ 8 o clock.
Party in Amsterdam, Keizersgracht 182 :) Festivities starting right now!

13342_350348980430_784785430_9966158_5558110_n

Things are going well, looking very forward to international launch.
We’ve changed a lot since the first reviews!

13342_350352790430_784785430_9966172_7726367_n

Beter pictures coming after the event :P

PS. Thanks to Python and Django, for enabling us to beat the competition :)

PSS. Next2News, eduhub, come and join :)

Apache & Business & Css & Django & Dutch & Events & Javascript & PHP & Prototype & Python & Symfony & Web Development & YouTellMe tschellenbach 11 Dec 2009 1 Comment

New YouTellMe release

We have been rolling out some awesome new features at YouTellMe.nl. The new version of the comparison system allows for the most flexible product comparison queries. Furthermore we now fully support product variations with easy selectors during price comparison.

Read the full story (in Dutch)

Business & Web Development & YouTellMe tschellenbach 08 Jun 2009 No Comments

YouTellMe @ Marketing Facts

Marketing Facts just published their video interview with our co-founder Joost Nauta. If your Dutch is fluent go ahead and take a look:


Interview John Nauta (YouTellMe) from mfredactie on Vimeo.

Thanks to all the FrankWatching readers for the positive feedback on the previous article.

Dutch & YouTellMe tschellenbach 03 Feb 2009 No Comments

YouTellMe in Frankwatching

YouTellMe has been progressing at insane development speeds. We’re slowly starting to search for some initial PR. Feedback has been great so far. Frankwatching just posted about us in their “Site Gespot” section. Im looking forward to the feedback from the Frankwatching audience. If you’re Dutch is fluent have a look at: frankwatching.

Web Development & YouTellMe tschellenbach 05 Jan 2009 No Comments

Open Coffee Amsterdam

Two months ago YouTellMe moved to the beautifull Keizersgracht in Amsterdam. With the crazy work schedules any entrepreneurs lives by, we didn’t really get to enjoy the city yet. In fact, I went to more Amsterdam based events when the company was still in Rotterdam.

This Thursday my fellow YTM entrepreneurs and me will be visiting the Open Coffee Amsterdam meetup. For me its a first timer on the longĀ  standing Open Coffee tradition. Hope it will be fun :)

Events & Web Development & YouTellMe tschellenbach 02 Jan 2009 2 Comments

YouTellMe in Twinkle

Twinkle, the online and offline magazine for ecommerce has just written a blog post about YouTellMe. A full article on YouTellMe may be found in the offline version of the magazine.

Besides our constantly growing group of beta testers these are the first screenies to go out in the open. The feedback of our testers has been very enthousiastic and I look forward to a full launch!

Web Development & YouTellMe tschellenbach 26 Jun 2008 No Comments