Live data from Hacker News

Moving from PHP to C saved my web startup.

news.ycombinator.com

71–80 of 85 posts

Re: Moving from PHP to C saved my web startup.

#71

php isn't terrible in general, but it can be the wrong tool for certain use cases, this being one of them. In the same way, apache is also not the right tool for some use cases, this being one of them. your solution works well for you, so stick with it. if you're thinking of scaling up further, also consider an event-driven server architecture (nginx, node.js, etc).

Agreed that PHP isn't terrible. Typically, it's the programmer's fault before it's the language's. Also, I agree that PHP isn't the right solution for every problem, but if you're set on using PHP for the wrong problems and need to bitch about it, see the previous sentence. A nice discussion on why PHP DOESN'T suck: http://stackoverflow.com/questions/309300/defend-php-convinc...

It's not that PHP is terrible. You can definitely write code in it that gets shit done.

It's that it exists in the same universe with Python, Ruby, Java, Clojure, Erlang, etc.

If you have the freedom to choose your implementation language, and those are your alternatives (to name just a few), that's when PHP is harder to justify. Not that it's terrible in isolation. In relative terms.

Re: Moving from PHP to C saved my web startup.

#72

Earlier quoted context omitted.

I'd probably go with node.js for this task - more manageable. Twisted has a huge learning curve.

If you want to stick with Python, tornado is a really good async server without all the learning curve of Twisted.

I wrote my own async servers and having done that (and used Tornado), I'm back on threads :) Async is kind of cool in some cases (long polling for one), but for most cases it's pain.

Right now mostly working on CherryPy's WSGI server.

Re: Moving from PHP to C saved my web startup.

#73
post #69

Earlier quoted context omitted.

I've stopped commenting about MRI entirely, it just makes people mad, and it's not even fun anymore. It's too easy. Still, I have to give Matz credit for making a language a lot of people sincerely love. I know it's splitting hairs whether bytecode + a VM counts as compiled or interpreted (it's both, really), but compiling to bytecode rather than a pure interpreter usually makes enough of a difference performance-wis…

If people would just stop talking about Ruby 1.8, it wold allow for more meaningful discussion. 1.9 is a lot faster and has better support for concurrency.

Indeed, it's too bad that the transition has been taking so long.

Re: Moving from PHP to C saved my web startup.

#76

Earlier quoted context omitted.

I've stopped commenting about MRI entirely, it just makes people mad, and it's not even fun anymore. It's too easy. Still, I have to give Matz credit for making a language a lot of people sincerely love. I know it's splitting hairs whether bytecode + a VM counts as compiled or interpreted (it's both, really), but compiling to bytecode rather than a pure interpreter usually makes enough of a difference performance-wis…

FYI, compilers are written completely different from interpreters. Bytecode languages are compiled as well.

I know, but often when people make that distinction, it's concerned with what performance ballpark the language has rather than strictly implementation issues.

Re: Moving from PHP to C saved my web startup.

#77

Earlier quoted context omitted.

Yes there are many penny auction sites out there. The whole reason to link it to facebook is so that you know its a real person you are bidding against. How do you know wavee has all real people bidding? You don't some of their users could just as easily be bots bidding items up automatically.

The thing is, Wavee is not an auction site. An auction site is one in which bids are free, and the winner pays what their bid says they pay. What Wavee had, and what you have built are, effectively, a method of taking money from people for the opportunity to pay money for something. Don't get me wrong, it's an amazing racket; Wavee makes 75 cents for every bid coming in to increment the value by 1 cent. Saw a $150 iP…

So now you have just jumped straight into calling me a crook. I'm sorry that Wavee or whatever site you went to took your money.

I honestly didn't know (and still don't) if you can make any money doing an honest penny auction site. We are just breaking even with this one so far.

The fact is that every time an auction goes up we have more risk than anyone else involved. If I put up a $500 iPad it could go for extremely cheap. The lowest one has ever gone for is 64 cents. That means we made less than $64 and still had to buy and ship that $500 iPad. And we have never sold anything for more than $26 which still isn't the $2600 you think it is because some packages give you more bids per dollar.

The legitimate complaint is when sites cheat. Which I would guess alot of them do. Using Facebook is not some trick to get people to trust us. Its a way for people to verify for themselves that they are in fact bidding against other real people.

How can you say that its a scam? Do you think we are just out there creating all these fake accounts with fake profile and personal photos and relationships etc. I can see maybe if we had 5 or 6 or even 20 users. But we have 100's of winners. That's a stretch even for the most paranoid and cynical of people.

Not everybody wins every time. But the data we have so far says that the majority of users that buy more than just a few bids are actually the ones getting all the deals. Its the people who come in and spend $24 expecting to win a $1500 item then leave when they don't. Those are the people who are losing. The users who are logical enough to see how the system works are the ones who get far more than they put in.

And some countries outlaw all kinds of crazy things, some countries are considering passing legislation to ban homosexuality so I guess we should all agree that its bad now too according to your theory?

Re: Moving from PHP to C saved my web startup.

#78

Node.js worked great for me for similar application. Built the web application in PHP and timers with Node.js

Was it an auction site as well? If so which one if you don't mind me asking?

Yes, it was a penny auction site. I can't give the URL as it is not my website. I assisted them with development.

Re: Moving from PHP to C saved my web startup.

#79
> I knew from reading articles on HN regularly that PHP is terrible, but I build the app in PHP anyways along with the 1 second callback

You always have to use the right tool for the job. It requires a deep understanding of what is actually going on inside the server when you write a line of code. PHP doesn't magically absolve you of that.

It really has nothing to do with PHP, C, Ruby or [insert your most reviled/loved technology here]. Calling a complex runtime for hundreds of near-contentless requests per second on a single machine is a really bad idea, no matter what environment you use.

Also, I'm sorry if I snipe from the cheap seat here, but 1 request per second per user doesn't seem like a great solution to your problem either. It might be more appropriate to just leave the HTTP connection open and push new data out through that when it becomes available, e.g. when something about the bidding process changes.

Re: Moving from PHP to C saved my web startup.

#80
post #66
post #46

Earlier quoted context omitted.

So instead of understanding the problem and implementing the simplest possible solution, you're recommending throwing more middleware caching crap at it? Brilliant engineering. I think I understand "web scale" now.

How is placing the blame on the wrong tool understanding the problem?

You're right, I should have read the OP more carefully.
Post reply on HN