Text

MySQL to MongoDB Migration with Django

Over the past week we migrated a big part of the Glossi data from MySQL to MongoDB and I’d like to share the process while it’s still fresh in order to help others facing the same issues.

Motivation
For the past 6 months, we’ve been running on a small Linode instance that contained our MySQL database, RabbitMQ and Celery, and Apache. Whenever we hit a problem, which was usually memory related, we’d just upgrade our instance. A typical problem was us getting Linode disk I/O alerts when our database could no longer fit in RAM and had to be offloaded to disk. After meeting with many people who are smarter than we are, we made the decision to move the bulk of our data, consisting of our users’ social media activities, to MongoDB. We decided to keep the more structured data, including our user profiles and credentials, in MySQL since it took up significantly less space and we didn’t want to significantly disrupt our code. Multiple people suggested using MongoHQ to host our MongoDB instance and we decided to give them a try. This would free up a ton of memory and also start moving us to a more scalable solution where the various system components are separated.

Approach
We dove right and set up a free instance at MongoHQ to use as our test environment. We researched various Python/MongoDB libraries and settled on using mongoengine since its model definitions were the most similar to Django and we felt it would be the quickest and least disruptive approach. As an example, we were able to transform the following simple Django model:

class Text(models.Model):
    text = models.CharField(max_length=400)

into

class Text(mongoengine.EmbeddedDocument):
    text = mongoengine.StringField()

After creating mongoengine versions of our models, we wrote a short script to copy a few objects from our MySQL database into MongoDB to make sure the models lined up and we were able to confirm that everything looked good through the MongoHQ web interface. The next step was to create MongoDB versions of our retrieval and insertion methods and make sure that they behaved identically. After that, we removed all references to the old models and made sure that we still had a functional product. As a final test, we renamed the to-be-deprecated MySQL tables in our development environment and made sure that there were no errors when we ran through our code. This led to us to discover a few edge cases that were missed in the earlier steps. The final data migration involved a script that pulled data from the MySQL database and then load them into MongoDB. Unfortunately, it took me too long to realize that we should have parallelized the migration process so it took longer than it should have.

Last Thoughts
In general, it was a relatively painless migration that was greatly simplified with the really helpful people at MongoHQ and our decision to use the mongoengine library. MongoDB does take a bit of time getting used to but it’s a mind-blowing experience, at least for me, writing your first functional map/reduce job. Another issue to be aware of is that mongoengine/pymongo and Celery may not get along. We ran into a few issues where our MongoHQ connections were not available but we were able to resolve them through some hackish means.

If you have anything to add or have any questions, please feel free to ask me at dan@glos.si

Text

Glossi Superuser: Doodlehedz

We had the pleasure of catching up with one of our most engaged users, doodlehedz a.k.a. Randi from New York City. Read on to find out what she had to say about Glossi, the big city, and more!

Instagram self-portrait

So tell us a bit about yourself.

I live in Harlem and work for a nonprofit on the Upper West Side as Director of Program Marketing. I think I’m pretty in tune with what’s going on with social media. I’m very involved with the Instagram NYC community, which is amazing. I love coffee, traveling, and my dog! And I love living in the greatest city on earth.

You have a cool logo on your personal site, doodlehedz.com. Who designed it?

I did! I’m a professional doodler.

I suspected as much, from your handle! So how did you find out about Glossi?

Good question. I think I saw someone post it on Twitter, and I immediately signed up for the beta. I want to try anything new. And I loved it as soon as I tried it.

What do you love about it?

I love the clean lines and automated layouts! I don’t have to spend hours trying to choose a theme. There’s also the choice to just look at images, articles, or videos - I get to customize the experience to what I want to see. I love how it autocrops photos, too. You see photos in a whole new way, and you’re curious to see more. And it’s great for discovery: like a more interesting StumbleUpon, because it’s for discovering people!

Your Glossi page features several shots of glasses and ties. What’s the story behind those?

The Instagram NYC community did a walk with Warby Parker, which was marketing genius. Over 100 iPhone photographers showed up! It was a great community event, and Warby Parker came away with hundreds of photos for their campaign. As far as the ties - I’m always looking to do something new and creative, so I started this #tieoneon series with a dapper colleague of mine. We wondered how we could turn that into something more, and thought of a clothing drive for men who might be in need of business wear. A local tie designer found the series on Instagram, and now we’re discussing a partnership for the cause.

It’s amazing to see the communities forming around Instagram, considering it’s currently an iOS-exclusive app. How did the Instagram NYC community get started?

It started as a meetup event. I’ve been involved since the beginning, when it was 20 or so people sharing tips and tricks. Everyone started following everyone else, and it’s an amazingly diverse community - from people in finance to nonprofit to freelance photographers. We’ve started partnering with companies that realize there are hundreds of freelance photographers who want creative opportunities, and are looking for that exposure. People from our community have even gone to Abu Dhabi to cover a sailing race for Puma! Now we’ve grown to over 130 people and we’re having our 1 year anniversary party soon!

Tell us about some of your interests, aside from photography, of course.

I’m an obsessive doodler, I love street art, and I’m a fixed gear bicycle rider. I love biking in the city year-round, though I wuss out in winter.

Time for some fill in the blank questions!

I would love to see a social network focused on…social action. People doing good things, giving back - all organized through social media.

The worst part of social media is…oversharing!

You should check out my Glossi page because…it looks really cool. Easy on the eyes!

And now for some favorites…

Favorite blogging platform?

Honestly, it’s Glossi right now. It’s the best of everything in one spot.

Favorite photo service?

I’m obsessed with Instagram, as far as taking photos. And I use Facebook for sharing, but it’s time consuming.

Favorite social network or social experience on the Web?

Twitter -  getting everything in 140 characters or less is amazing. If I’m interested, I look; if not, I move on. It’s the greatest thing since peanut butter and jelly.

Last question: there’s a lot of buzz right now about personal branding through social media. What impression do you hope to leave from your online presence?

That’s a really good question. What I want people to take away is: what you see is what you get. I don’t edit, whether with photos or tweets. I’m honest, I don’t hold back. I love Twitter and Instagram for expressing what I feel and see in the moment, it’s the perspective from where I’m standing. Hopefully, people get a taste of NYC the way I see it. Thanks for stopping by, and feel free to come back and drop me a line!

Thanks for chatting with us, Randi!

Keep up with Glossi on Facebook, Twitter, and Google Plus.

Text

Customized Profiles

It’s been a long time, we shouldn’t have left you…without some Glossi updates to look forward to!

After a bit of a hiatus, we’ve released some new features. Now you can add your full name, customized photo, and tags to your Glossi profile. Log in, go to Account, and then Profile under Account Settings to customize your profile.

Tags: update
Link

Reach out to your reps! And if you think you can’t make a difference, remember this.

utopianfiat:

PROTECT-IP:

SPONSOR
  • Patrick Leahy [D-VT]
CO-SPONSORS
  • Lamar Alexander [R-TN]
  • Kelly Ayotte [R-NH]
  • Michael Bennet [D-CO]
  • Jeff Bingaman [D-NM]
  • Richard Blumenthal [D-CT]
  • Roy Blunt [R-MO]
  • John Boozman [R-AR]
  • Sherrod Brown [D-OH]
  • Benjamin Cardin [D-MD]
  • Robert Casey [D-PA]
  • Saxby…
Text

Layout improvements thanks to Isotope

As you may have noticed, we recently improved the way our layout is generated and we want to give a big thank you to David DeSandro for creating the Isotope jQuery plugin. It’s a great way to tile different-sized rectangles into a grid. We pride ourselves on our ability to generate an elegant pseudo-random layout for every one of our users, and have spent a lot of effort on creating a layout generation engine.

At first, we had a predefined set of layouts that we’d try to pick from based on the incoming content. That led to issues where an incompatible layout was selected, which led to only a subset of all moments being loaded. In a later version, we made a slight modification to reduce the number of dropped moments, but that still didn’t work as well as we wanted. It was akin to writing a Tetris-playing algorithm that tried to minimize the number of empty spaces. Unfortunately, this approach coupled with our random layouts made debugging difficult.

These issues led us to investigate other tools that were both simple and flexible. After a bit of searching, we found Isotope. Since it’s built on top of jQuery, we were able to get it up and running quickly while simplifying a lot of our backend code. Isotope also provides the ability to sort and filter, which we are integrating into Glossi. A big thank you to David DeSandro for creating Isotope and making this possible!

Text

American Censorship Day

Today, you will see a “STOP CENSORSHIP” bar covering our logo in protest of the PROTECT IP Act (SOPA). The act voids many of the safe-harbor benefits created under the Digital Millenium Copyright Act of 1998, which encouraged the rise of many websites containing user generated content. These include include almost every social media site around right now - YouTube, Facebook, Tumblr, Twitter, etc.

These measures will make it much harder for startups to form, let alone succeed. Imagine the next YouTubes and Facebooks that are in nascent stages right now, never getting off the ground due to this legislation. In these tough economic times, this is the wrong path to take. At a time when it’s critical to support innovation and new businesses, this legislation will do the exact opposite.

We’re passionate about this issue, and we hope you will reach out to your representatives and voice your concern about the PROTECT IP Act. Click through to find out more.

PROTECT IP Act Breaks The Internet from Fight for the Future on Vimeo.

Photo
dangoldin:

Motivational!

dangoldin:

Motivational!

Tags: motivation
Text

Infinite Scroll, Layout Improvements

Infinite scroll
The fewer clicks, the better. You can now scroll down a Glossi page to automatically load the history without having to select another date range.

Layout improvements
Did you ever want to just look at pictures, articles, or videos? Now you can filter to what you want. Just choose the type of moments you want to see, and let Glossi do the work. We’ve also moved the text-only data into one section to make navigating Glossi pages a breeze.

Text

Google Plus Support, Member Survey, Friend Invites


Survey

We’re working on some new features to make Glossi even better but we want to make sure the features we build are the right features. What better way than a survey? It’s super short and will give you a chance to tell us a little about how you use Glossi and what you want to see next. Take the survey.

Google+ support

At long last, Google+ support! Simply connect it on your account settings page. Note that it will only pull in data that is posted publicly.

Invite your friends
We’ve now made it easy to invite your friends to Glossi. You will see a “friends” button in your main toolbar: click the button to open your friends list. At the bottom of the list, you’ll see an invite link that you can share with your friends, post to your social networks, or even to your own blog or site.

Layout improvements
No more dropped content. The latest update ensures you get all your great content right on your Glossi page. Let us know what you think!

Text

Videos!

Video Support
Glossi now displays your videos! Whenever you post a video on Twitter or Tumblr it will automatically be pulled and included on your Glossi page. To play a video - just hit the play button!

Performance Improvements
We also noticed that some Facebook data was not being pulled. Going forward, all your Facebook status updates, photos and checkins should be available in Glossi.