

Ask HN: Our site just got onto Mashable - HELP - wesleyzhao

Hey Everyone,
For the past few weeks my friends and I have been hacking together small projects from our dorm rooms trying to find something that would stick.<p>Two days ago we released WhereMyFriends.Be, and last night we were fortunate enough to have been posted on Mashable! We immediately were forced to migrate to Rackspace to make sure our site stayed up: http://wheremyfriends.be<p>We have been up all night maintaining the site, catching any bugs from users, and just making sure things go smoothly.&#60;p&#62;We have noticed the site slowing down over the course of the night and have been on phone with Rackspace. They think the problem may be a piling queue of requests to our MySQL data tables (which are currently using MyISAM).<p>We really want to get the site back up to speed as soon as possible but we are honestly at a loss for what to do. We've never experienced a traffic surge like this before. We are on the verge of putting up a landing page and stopping the flow of Mashable traffic.<p>Does anyone have any suggestions for what we can do to get ourselves back up and running?<p>Thanks for any suggestions!<p>(Note: we are using PHP, MySQL, Javascript)
======
sagacity
Also, as discussed in one of your previous threads, in case the current
Geolocation API you're using is slowing things down (at least in part), you
might want to try this:

<http://news.ycombinator.com/item?id=2255089>

Edit: Or, directly: <http://IPLoc.info/api>

(Partly inspired by your thread from which, I sent you an email, but never
heard back from you.)

If you wish to try this, I'll be happy to work with you to get our (free)
geolocation API setup on your site _quickly_.

~~~
dshipper
Thanks so much I really appreciate your help, and sorry for my delayed
response to your email. Hopefully we can get your API running with our setup.

------
dmc
Without being familiar with your service, do you implement caching?
memcached[1] may lighten your load if you do not.

What web server do you use, apache? Perhaps nginx or lighttpd would be a
better fit if you do use apache.

Check out this post[2] for more details on decreasing load.

and try not to knock your server offline at your peak time ;)

HTH.

[1] <http://memcached.org/>

[2] <http://news.ycombinator.com/item?id=2220273>

~~~
dshipper
Do you know if we would be able to implement on Rackspace's Managed Cloud
hosting? Considering we haven't slept in forever it seems like it would be
hard for us to learn how to set up a new server manually at this point :)

~~~
dmc
I'm not familiar with that service, sorry.

However, looking at their FAQ from [1]:

"Totally customizable, each Cloud Server gives you full root access"

so I would imagine you can make any changes you'd like. However, every host is
different and YMMV.

[1]
[http://www.rackspace.com/cloud/cloud_hosting_products/server...](http://www.rackspace.com/cloud/cloud_hosting_products/servers/faq/)

------
dclaysmith
I would:

* Change the landing page you have up there. Focus on the product (not your current predicament). A few screeshots. Make people want to comeback later today or tomorrow.

* Eliminate any non-essential database calls. Convert php files to static html (or copy and paste the output of the page and just echo it).

* Check your slow query logs in mysql and index. Definitely make sure you have any primary keys set and foreign keys (used in joins) indexed. Then look at your queries and add index on your slowest queries.

If you aren't sure it's MySql, copy all of your images onto Rackspace cloud
files/amazon s3. This will lower traffic through your machine/disk access.

~~~
wesleyzhao
_We wanted to really focus on our story since we are hoping people will
continue to use the apps we create and they will know us for being people the
love. Rather than just focusing on the product.

_ We have combed through the code and believe we have eliminatd non-essential
database calls but will look again. Also I guess we could always use static
html for header/footer rather than including/requireing it.

*What is a slow query log?

~~~
sfrench
| What is a slow query log?

It's basically a log kept of queries that are running slower than a set
threshold.

Read through this for the details to set it up and access it:
<http://dev.mysql.com/doc/refman/5.0/en/slow-query-log.html>

------
hallmark
Hey guys, first off, congrats!

You'll get many snippets of advice here, and tons of web resources to chase
down and read.

If you want to revert back to a live site quickly, may I recommend direct
help? I'll step in first and offer my services. Or ask here and I'm sure other
HNers will step up as well.

I've troubleshooted MySQL slow queries. I've done memcaching and static file
hosting on CDNs.

If it takes a ton of effort, we can figure out compensation once the site is
back up and running like a charm. If you don't have any money, list my name
somewhere and help me build my personal reputation. :)

HTH. I've also sent an email to Dan.

~~~
dshipper
Thanks so much for all of your help so far!

------
rst
At the risk of stating the obvious, you might want to check the query plans on
your most common mySql queries, to make sure that all the appropriate indexes
are in place and in use. I've not done this with mySql myself, but this looks
like it _might_ be useful:

<http://www.learn-mysql-tutorial.com/OptimizeQueries.cfm>

------
fhars
If you are writing frequent updates to your MyISAM tables, you should switch
to a database backend that allows concurrent updates. MyISAM is only useful
for read-mostly or single writer scenarios. See also
[http://www.mysqlperformanceblog.com/2006/06/17/using-
myisam-...](http://www.mysqlperformanceblog.com/2006/06/17/using-myisam-in-
production/)

~~~
wesleyzhao
Thanks! I think we have switched over to InnoDB, you think that may be
sufficient?

------
sagacity
Congrats!

You might want to check this (and possibly also the parent thread), quick:

<http://news.ycombinator.com/item?id=2235994>

God speed. :-)

------
jimboyoungblood
How much traffic was Mashable throwing at you?

~~~
wesleyzhao
We got about 20,000 hits just form last night! It was huge and very exciting
for all of us. You can't imagine all the girl-like screaming going on in our
dorms and our freaked our roommates.

------
thomasdavis
What technologies are you using?

~~~
dshipper
We are using PHP, Javascript and MySQL

