Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing efficient .Net/SQL Server code [closed]

Let me preface by saying I am not knocking .Net (it helps me earn my living)...

I recently heard of a site were the developer/owner bragged that he had minimal hardware to support his site (plentyoffish.com). This site is listed as being in the top 50 in terms of traffic on Alexa. I am struggling to wrap my head around how something like that can be acomplished by doing what the developer/owner claims, a single developer writing a site (it took him 2 weeks to get the intial site up) using minimal hardware that gets 2 million hits per hour (peak). Larger companies have huge web farms to handle traffic like that...

How do you write code so efficient, with limited hardware resources (he claims he uses only three DB servers)? Has anyone worked on or developed a site that efficient?

like image 867
Miyagi Coder Avatar asked Nov 30 '22 12:11

Miyagi Coder


2 Answers

The Microsoft stack is remarkably fast if you avoid all the drag/drop garbage that gives ASP.NET a bad name.

  • IIS is a good web server.
  • SQL Server is a good database.
  • C# compiles to fast code. (qualifications probably needed here :)
  • ASP.NET can be quite lightweight if you use it correctly

That's the whole stack. It's all good. You can say what you like about Microsoft, its business practices and its consumer products, but their development tools and servers are top notch.

My personal experience with their web stack includes a site that sees ~500 pageviews/second and seldom spikes the server above 15%. That's fast enough for most operations.

like image 56
Jason Kester Avatar answered Dec 04 '22 08:12

Jason Kester


It's more than just the code: doing something like this requires a cooperative effort from developers, DBAs and IT. Each member of the team has to recognize the impact that their work has on the other areas of the team.

When a developer writes a query that does a table scan on a heavy OLTP system, he has to understand why it won't scale. When the DBA sees a table scan, he has to understand how to fix it at the database level or at the code level. When the sysadmin sees heavy read activity on the drives, he has to understand the underlying causes of it (things like table scans) in order to decide whether to fix it with better code or throwing more drives at it.

Well-performing systems are the result of each person doing a great job, AND communicating really well with the other team members. If just one member of the team is out to throw everybody else under the bus, the system won't perform. And it sounds like you're already doing it by throwing .NET and SQL Server under the bus. ;-)

like image 31
Brent Ozar Avatar answered Dec 04 '22 08:12

Brent Ozar