Satya's blog - 2008/

Dec 24 2008 10:50 Build notes for the Windows/Game system

Objective: a sub-$200 (in new parts) gaming computer capable of playing a not-too-demanding modern game like Battlefield 2 without a lot of lag.

Pictures are here

  • AMD Sempron 64 3800+ Manila 2.2GHz Socket AM2 Single-Core Processor Model SDA3800CNBOX - Retail $29.99
  • Kingston 2GB (2 x 1GB) 240-Pin DDR2 SDRAM DDR2 800 (PC2 6400) Dual Channel Kit Desktop Memory Model KVR800D2K2/2GR - Retail $22.99
  • Antec NSK4480B Black 0.8mm cold-rolled steel construction ATX Mid Tower Computer Case 380W Power Supply - Retail $69.99
  • JetWay JM26GT4 AM2 NVIDIA GeForce 6100 Micro ATX AMD Motherboard - Retail $39.99
  • Subtotal $162.96
  • Tax $0.00
  • UPS 3 DAYS $35.56
  • Order Total $198.52

I'll be using the old 80GB IDE hard drive in this one, with a 20GB Windows partition and the rest for data. I'll also be using an nVidia GeForce 6600LE that I bought for the other computer and didn't use (since the other one had an HDMI-to-DVI adapter). The 6600 is supposed to be better than the 6100, and anyway the on-board one supposedly uses system RAM instead of dedicated VRAM.

The AMD CPU is about $40-$50 cheaper than a comparable Intel CPU. My alternative was the Intel Wolfdale E5200 at $82, but it is dual-core unlike this AMD Sempron. That dictated the choice of motherboard, which is simply the cheapest one with AMD support and a PATA connection. I want analog video out (VGA) anyway, because of the way I have the shared monitor hooked up.

2GB for the RAM, because 1 isn't enough and Windows XP is supposed to choke on anything more than 3. Since the board and RAM are dual-channel, 2GB it is.

With the IDE hard drive and IDE DVD drive, I made sure to get a case where all the drives mount in the same direction. But I still had to use the long cable I bought for the other build. Apparently it works with everything but the DVD burner I have, and I need DVD burning in my primary Linux box, and I don't need it in my game box. So the game box has a DVD-ROM drive in it and seems to work with the long PATA cable. Antec supposedly makes good cases, so there we go, it's the cheapest Antec case that fulfills my needs.

I will install the CPU and RAM on the motherboard first, before opening the case. But I will need to open the case to ground myself.

Case opens from top

The case opens at the top with 2 thumbscrews. Sharp-ish edges as noted in the reviews, but come on, it's a steel case. Be careful. The side panels lift up and out, and even the front panel is fairly easy to remove as long as you can pull the panel while releasing each of the 6 tabs, tightest one first in lockpicker-style.

The case contains the usual spare hardware, screws and so on, and a power cable. It has a rear 120mm fan with speed control switch, a CPU duct, and no other fans besides the PSU (power supply). There is a bracket for a front 80mm fan, and the ability to mount one under the side duct.

Case content details

Cute. There's a loose piece of 8-inch cable tie in there. There's a plastic wrap-tie in the screws pouch, along with a case badge and an unexplained metal bracket.

With this 380W PSU, I have to watch my power consumption. I'm not sticking anything complex in there. Besides the inventory above, it's going to be a hard drive, an optical drive, and an nVidia GeForce 6600.

The hard drive cage is detachable, which is good because there are no drive trays. It's hard to screw in a hard drive while supporting it with one hand inside a cramped box. Eww, the 5.25" optical drive bays have pop-off metal covers. At least the gap left by them will be covered by the front panel's more-modern re-attachable plastic covers.

Isn't this nice: the front plate bezel pops off completely. I can stick an air filter in there, but who's going to clean it, and when? The case has several air holes. I'd like to cover those with filters, but again who's going to clean/change them? Hmm, front panel comes apart into two pieces. Handy.

AMD nVidia motherboard

Motherboard box comes with the usual manual, driver disk, back plate, 2 SATA and 1 PATA cables, and the board. This board takes 24pin ATX power (with the last 4 pins covered by a removeable tab, what's up with that?) plus 4-pin power connection, plus CPU power connection.

CPU and motherboard

I have broken the seal on the CPU box. As usual with current CPU retail boxes, it's filled mostly with heatsink and manual. I hope it comes pre-greased, as I don't have any thermal grease. It does come pre-greased. Adding the HSF (heatsink-fan combo) is a little easier on this than on the Intel board, maybe because I'm doing it before inserting into the case.

CPU and HSF installed

The RAM was a little hard to get out of it's packaging, but it's in there now. It's uncomfortably close to the CPU, and I'm worried about heat. AMD CPUs have historically run pretty hot. The Northbridge heatsink is also pretty close to the CPU.

Case feels pretty light with all the panels off. The stock back panel (over the rear mobo connectors) is wedged in real good, had to hammer on it with the handle of a large pair of scissors. Unlike the other Zotac board, this mobo one has just 6 screw holes for attaching to the case.

Okay, the metal grilles over the 5.25" bays are practically impossible to break off by hand. Only the top bay is open and given that this is an all-PATA system with a board that has only 1 PATA connector, I need to make sure the IDE cables will fit with the optical drive in the top bay. I don't want to use the extra-long cable I have because I suspect it has issues.

Screw access holes

It's not easy to detach the hard drive cage as there are two screws under it, in an awkward position even with the case laying on its side and not full of dust. The cage does have metal tabs, so you don't have to use one hand to awkwardly hold up the drive while using a second to hold the screw and a third to turn the screwdriver. There are holes in the right-side of the case for hard drive screw access. The hard drive bays have silicone grommets, and the long screws necessary are included with the case. A long magnetic screwdriver is also needed to get in from the right.

When I am ruler of the universe all PCI and similar cards will have handles to pull them out.

Oh, neat, the rear slot covers pull out. I thought they would have to be broken off, since they lack screws. But they're just held in place by friction. With the video card installed, I notice that the large heatsink on the GPU (Graphics Processing Unit) and VRAM (Video RAM) is below the card when the case is in its operating position. Anyone else notice that heat rises? I guess it's supposed to be more of a radiator and spreader than a convective cooler, but still.

I knew I did something stupid: badge on front of case has been glued upside down.

Build complete

Due to the CPU duct and the way the side panel closes (it slides down from above by about half an inch) it's a little hard to close, especially with my big IDE cable in there. The duct helps move the cables away from the CPU and the video card, though, but I should route them better. Which I have now done. The side panel closes a little easier now. Sure, the fan wires are taped to the bottom of the PSU, but who cares.

CPU duct and panel grille

I've added a few air filter swatches inside the side panel grille and in the CPU duct.

This power supply, an Antec Earthwatts 380W, also has a hard switch on the back. Powering up....

Well, that's interesting. My ancient Windows XP boot CD does not recognize the on-board network adapter. Oh, well. Either it'll be on the motherboard's disc or I can find a generic one online and transfer visa USB. Here's a hint, though, my XP disc may not work on new computers much longer. Or are modern CPUs still capable of emulating 8086 and Pentium?

Interesting, XP detected the network right after installing the drivers from the mobo disc. No reboot needed. But I don't think it's doing very well with the video -- dragging a window is slow and jerky. Bet it doesn't have the drivers. (Yes, installing the drivers made it much better.)

How bad is it to reverse the polarity of the electron flow across a photon emitter? Translation: I plugged in the power LED backwards

Downloaded the nVidia drivers. 80 megabytes, sigh. Installing now. My standard loadout for a Windows system includes Firefox, AVG Free, and Zonealarm free, and I'm adding WinSCP to this system. I also installed a motherboard monitoring app from the mobo disc, as well as sound, network, and System Management Bus (SM Bus) drivers. Eventually the Windows Device Manager stopped showing yellow exclamations or red whatevers.

Also downloaded the latest Quicktime, because Septerra Core keeps crashing on startup. I wonder what else is missing or unsupported.

New system doesn't feel very fast, despite turning off all the eyecandy stuff that Windows brings in (the equivalent of turning off Compiz, I guess). Battlefield 2 seems to run better.

According to the mobo monitor, system temperature is about 85 degrees Fahrenheit and CPU varies about 90-96 Fahrenheit. According to my wattmeter it takes 60 to 90 watts and about 750mA.

Tag: geeky hardware

Dec 19 2008 23:14 CD-ROM on ubuntu Ibex
Google-bait: On Ubuntu Ibex 8.10, with an IDE (PATA) CDROM/CD-RW drive, the drive is detected just fine, dvd+rw-mediainfo sees it, but on trying to mount it with Gnome I get messages like "Unable to mount media" and other things implying that there is no disc in the drive, as if the disc is not sensed. Adding this to /etc/fstab solves the problem:
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0

Tag: geeky linux

Dec 18 2008 15:10 New Linux computer build notes

I bought a new computer in November/December 2008, to replace the aging Linux box (I have good reason to do that). Here are the build notes.

I bought all the components from Newegg. They arrived in 5 boxes: 1 vid card, 1 case (obvious), 1 cpu, 1 mobo, 1 hdd, plus 1 envelope for RAM.

I bought a new hard drive so I could easily install a new Ubuntu Ibex system from scratch, and then have the old system available for reference. I could also put in just the old drive to get the old system back if I had to.

The case is an Antec Sonata III with Earthwatts 500W power supply, which is apparently auto-sensing 110-240V. The case fan has a 3-speed switch, and connects to a hard drive power connector (4-pin Molex).

PSU has hard switch on back. Front panel switch on modern cases connects to the motherboard for "soft" power switch. There was a random unexplained piece of brown paper in there, about the size of an ATX motherboard. The box also contained a power cord, manual, and (hidden behind the hard drive trays) a box of screws and stuff.

The hard drive trays have silicone grommets for noise reduction, but do they need special screws? (On second though, I don't think those screws are too special.) The case is lockable and comes with keys. It has a front air-filter, which is washable but hard-to-reach.

Lots of internal power connectors in a big wad: 3 hard drive/CDROM connectors on 1 wire, 2 HDD + 1 floppy connector on another. Lots of 4- and 6-pin power plugs. Another 2 wires with end- and center-located thin flat power plugs. These turned out to be SATA power. Bundled most of the wires out of the way.

A mystery: which one is the motherboard? Found it. Inside the shipping box was a plain box. On top of inner box, was packing peanuts. what about sides and bottom?

I changed the back plate and installed the motherboard. The motherboard did not power on, did not beep the speaker, did nothing. I found a pencilled note in the manual, apparently from someone who had bought and returned it, saying that it was bought from Newegg.com and was dead, so they returned it. I returned it, too. Newegg charged me $10 for the return shipping, and a $6-ish re-stocking fee. That was Saturday. After talking to customer support on Monday, they promptly agreed to refund both fees. I confirmed this with customer support on Tuesday. The next week I again contacted customer support, and they claim to have issued a refund.

A note about Newegg customer support: They're only open Monday-Friday between 8AM and 5PM (approximately) American time, and there's a long wait between initiating chat and someone getting to you. But, they tell you approximately how long the wait is, and once they started talking, they understood my problem and agreed to refund the money right away.

As of this writing, the shipping cost has not been refunded but the re-stocking fee is no longer mentioned anywhere -- I'm guessing they'll return the full amount without subtracting the restocking fee.

On Saturday, more than a week after the first order, I also ordered a different board, this time a Zotac brand. It arrived Wednesday. Not being an "open-box" item, it came in a nice decorative retail box, inside which was a cardboard box (boo for environmental consciousness, yay for packaging). Oh, and Newegg packed this one a lot better than the previous one.

One problem: motherboard power LED connector is 2 pins, case plug is 3 pins. Not a big deal, just means no power indication.

The board, like many cheap modern boards, has only 1 PATA connector. This means twisted short cables or buy a long round cable. I bought a longer cable. It has plenty of SATA connectors, only 2 DIMM slots, takes DDR2 800 RAM, 2-3 PCI slots, supports Intel Core 2 Duo (but I'm using a Pentium -- without virtualization support), lots of USB (including USB case headers i.e. connectors for the case's front panel), Fire-wire/1394 (I need that), and PS/2 connectors, very important for my Model M keyboard and Microsoft mouse. And on-board Ethernet and audio, which every modern board seems to have.

The motherboard box says FSB 133MHz, DDR2-800, 8 channel HD audio, SATA 3GB/s, Gigabit LAN, and MicroATX. (Recording this for posterity, before I recycle the box.) It also says supports Intel Core 2 Quad and Duo, and Pentium dual core and Celeron. 2 PCI dlots, 1 PCIx-1, 1 PCIx-16 (graphics).

The CPU retail box was pretty small. Inside it was mostly heat-sink+fan. cpu is tiny. It's like the TNG scene where Data gets his emotion chip. 1 heat-sink peg broke. Had to remove the mobo from the case to fit it anyway. Tip: easier to assemble on-board components (besides PCI cards) while mobo is NOT in case. This heat-sink, and I suspect other retail bundled heat-sinks, came with thermal grease already applied to it.

Connected up the CPU, RAM, and motherboard and powered on. Ah, on-board PC speaker. That's why there's no speaker connection on the mobo for the case. BIOS seems easy enough to use. Can enable/disable various things, devices, etc. Can set boot order, don't see USB boot option maybe I missed it. Can set memory timings -- leaving those alone.

nVidia northbridge is supposed to be "big fail" on Linux. Sigh. I hoped it's only the video, as I do have a PCI video card I can use. So far, it works fine on Linux at about 1280x1024 at 60Hz.

The 3.5" drive bay very difficult to get out, and even then the hard drive won't fit in it without leaving a hole in the front of the case. And that's just yucky. That's when I ordered the extra PATA/IDE cable. Newegg took a week just to process and ship it. I guess they are busy around the holidays.

It's hard to route cables behind the hard drives -- and you need extra-long cables because of the silly orientation of the trays. Tip: take out all the trays, route the cables, and then install the drives. This also means that I need a long IDE/PATA cable (see above) with long distance between the connectors, since the PATA hard drive is so far away from the nearest optical (DVD) drive bay (the lowest 5.25" bay).

Front USB and audio headers connected. SATA hard drive installed. DVD writer installed, but waiting for new cable.

Linux Ubuntu Ibex installed. At first it refused to run in anything higher than 800x600. Turns out adding HorizSync and VertRefresh to the Monitor section of xorg.conf was enough. gdm restarted, resolution looks fine. In /etc/x11/xorg.conf, I added HorizSync 30-81 and VertRefresh 60

Installed packages to make the system similar to the old one: dpkg --get-selection on the old one, and then look through the list installing packages that I want.

I spent all morning comparing package lists for dpkg between old and new boxes. Next time, dump the list with dpkg and diff.

On-board video has a HDMI-to-digital adapter, so I can use it. It is GeForce 7100, nVidia 630i. Video card I bought is GeForce 6600LE 256MB Matthew said that on-board probably has less RAM or uses system RAM. On-board has 5.3GB/s memory bandwidth versus 16 for the 6600, and 1.4 billion pixels/sec versus 4 billion for the 6600. On-board is 7100, higher number but seems to suck more?

I wonder if I can use one of the graphic systems for actual display and the other one for folding@home or something.

http://www.nvidia.com/page/geforce_6600.html http://www.nvidia.com/page/geforce_7100.html based on those two, 7100 is 64bit 6600 is 128bit. And the memory bandwidth differs by a *lot*. I have decided to stick with the on-board 7100 for now. It works for my needs.

(Given that I bought a second system for gaming -- 200 bucks for the parts I needed -- I can use the 6600 in that one.)

Pricing:

  • Antec Sonata III case ATX 500W $74.99
  • Corsair 2x1GB 240 pin SDRAM DDR2 800MHz PC2 6400 $39.99 ($30 MIR)
  • Total $114.98 free ship no tax
  • Gigabyte GA-G31M-S2L LGA 775 Intel Micro ATX mobo 40.99 (open-box)
  • Sparkle GeForce 6600 GDDR2 $19.99
  • Pentium E5200 2.5GHz $82.99
  • Total $143.97 shipping $11.60 grandtotal $155.57
  • okgear 24" SATA cable GC24AURM $1.99
  • WD Caviar SE 320GB 7200RPM 3GB/s OEM $52.99
  • subtotal $54.98 shipping $6.99, total $61.97
  • ZOTAC N73PV-Supreme LGA 775 NVIDIA nForce 630i GeForce 7100 HDMI Micro ATX Intel Motherboard - Retail $49.99 ($10 MIR )
  • $8.97 shipping no tax total $58.96
  • IDE cable 13.99-10 coupon
  • shipping 8.25, total 12.24
  • Return shipping for defective motherboard = $10.12 (should be refunded)
  • Total items: $326.92 (excluding RMA board)
  • Rebates: $40
  • Shipping: $35.81
  • Grand Total: $322.73 ($312.61 after RMA shipping refund)

If you exclude the video card, which isn't being used for this system, the total comes to just under $295. Oh, plus Use Tax.

Pictures are available

Update 2008-12-21: My PATA DVD writer (Optiarc) wouldn't work as a secondary on the new long cable. Rather than buying iffy PATA-SATA adapters, or expensive ($50!) PATA PCI cards, I bought a $25 (free shipping) Optiarc drive that's just like the one I have, except it has SATA interface. So I'm out one cable, I have an extra DVD writer, and the price of the system went up by $25.
Additionally, Newegg has refunded the bad motherboard's price but hasn't yet returned the shipping cost, despite repeated assurances from customer support that it'll show up in "3 to 5 business days". and they've finally refunded the return shipping cost.

Last updated: Jan 24 2009 19:35

Tag: geeky hardware

Dec 18 2008 11:17 New pictures: Star Wars and Florida 2007

Tag: whatsnew

Dec 13 2008 10:52 Power consumption of various components

I bought the parts for a new computer during the Black Friday sales (mostly from Newegg). That gave me the chance to take several readings:

  • Old deepthot (big black and silver Dell)
    • boot: 100W
    • running: 90-120W
  • LCD monitor:
    • standby: 2W
    • operating: 20W
  • Old deepthot without keyboard: 69W 0.58A, with keyboard 69W 0.59A (IBM Model M keyboard)
  • New computer with motherboard, DVD, RAM, and CPU installed:
    • PSU turned on: 1W 60mA
    • startup: 30W 0.25A
    • memory test: 60-65W 0.5A
    • installing stuff: 55W 0.5A

Tag: geeky

Dec 12 2008 10:36 Kashi cookies packaging fail
Kashi brand cookies packaging fail: The company wants to be environmetally friendly, make healthy food. I think they mostly succeed, except for their cookies: outer cardboard box, inner plastic/paper carton, plastic cookie box inside that. At least it's not as bad as the Chips Ahoy cookies I used to eat. And paperboard is recyclable now.

Tag: consumer

Dec 07 2008 21:58 Rails: Storing data in a session

Rails: Storing data in a session, and why it's bad.

Suppose you're doing a Ruby on Rails application. You show a list of classes, and let the user click one to view the list of students in that class. Great, store the class id in the session. Wonderful. Now suppose you do something to those students -- mark a number of them as "absent" or whatever, from the student list screen. Okay, which class are we looking at? Oh, we stored that in the session, didn't we. Great.

Now suppose someone like me comes along and opens two classes in two separate tabs/windows of the browser. Oops. Which class gets modified when I mark both sets of students?

Big deal, you say, why not operate directly with the students IDs? Yes, we could, but that was a contrived example. The real-life example I ran into had a list of courses and their groups, and when you modify and save the groups, it would delete them all.... suffice to say, the ID had to follow the page by being a form parameter, and not obtained from the session.

If there's a way to store page-specific session data, I don't know it. You could store a hash keyed by the page's parameters, though.

If you were looking for a way to actually store data in the session, go read the docs for the details. Basically,

session[:key]=value

Tag: geeky rails

Dec 04 2008 13:36 RPG: Septerra Core
I was saying something about Avatar: The Last Airbender on a chat channel recently (I forget why; it's not like I watch the show or anything), when I brought up Septerra Core. I don't know why the two are associated in my head, but there you go. I said (paraphrased):

It's the usual target-bait: minimal RPG, huge in-game movies for "better atmosphere" i.e. longer load times, interminable waits, etc. Well, actually, it's quite good about that; very few quicktime movies.

Target-bait: games that are only sold in Target in the $9.99 or less aisle, and have the afore-mentioned quicktime movies in lieu of real graphics. I'm looking at you, Dark Side of the Moon.

(David K said:) And those QT movies are the only screenshots shown on the box. (I said:) The qt movies have worse graphics than the actual game [Septerra Core] because they compress the frag out of them

Tag: game

Nov 24 2008 10:25 Rails: Override Table Name Quoting

We had a situation where our Sybase database didn't appreciate that Ruby on Rails was quoting table names like so: [table_name]. The square brackets are okay in Sybase but our particular database was too old for it. So, I have to override table name quoting. In my Rails app, in config/initalizers/sybase_adapter.rb, I place this code:

# sybase_adapter.rb
# stolen from rails' to override the table name quoting. []-quoting throws off atlas server.

module ActiveRecord
  module ConnectionAdapters
    class SybaseAdapter < AbstractAdapter # :nodoc:
      def quote_column_name(name)
        # If column name is close to max length, skip the quotes, since they
        # seem to count as part of the length.
          name
        #((name.to_s.length + 2) <= table_alias_length) ? "[#{name}]" : name.to_s
      end

    end # class SybaseAdapter
  end # module ConnectionAdapters
end # module ActiveRecord

And it works. Table and column names are no longer quoted. Much thanks to folks on the #rubyonrails freenode IRC channel. Specific users: %w[ blj Bobnation defswork jammanbo rsl ].join(', ').

Update: For some reason, this didn't work with active scaffold on Rails 2.1. Shrug.

Last updated: Dec 04 2008 13:43

Tag: geeky rails

Nov 20 2008 20:27 India declares War on Piracy

A BBC article about piracy in the Gulf of Aden says one-sixth of the world's sailors are Indian. This makes Indian sailors a big target for pirates. A lot of Indian shipping goes through the Gulf of Aden, apparently.

Cool. Real pirates suck.

Update: The "Cool" part was that the Indian Navy is going up against the pirates. At least one ship is patrolling the area, according to the BBC article

Last updated: Nov 21 2008 13:22

Tag: news

Nov 19 2008 08:02 PHP and Ruby on Rails compared

I received an email asking about differences between PHP and Rails. This is my reply. It has been cleaned up a little. It is not comprehensive.

Both PHP and Rails address the same domain: making dynamic web sites, in different ways. PHP, at heart,is a language that embeds itself in your HTML document. Now, it's OOP-ness and other things (such as template libraries) make it much more than that to the point that people forget what it is, but still. In Rails, the HTML page generation happens at the end of the request-response cycle....

Both are pretty newb friendly. I believe it's easier to write bad programs in PHP than in Ruby, though.

At this point I'd like to point out that Ruby is a programming language (notice I didn't say "web") and Rails is a web programming framework (notice I *did* say "web"). I point this out because people at work are always confused. And in the above paragraph, I compare PHP with *Ruby*, not Rails. When you build a RoR web site, a lot of the programming you do is in Ruby, hence the comparison.

As for function and speed: Rails, being Web-oriented in a Web 2.0 world (that means AJAX and dynamic HTML tricks are the norm rather than an exception -- and they're not to be used gratuitously, but only where needed -- and since many browsers are in Web 1.5 (I make that up) or earlier, AJAX should not be a necessity, which means it should be added on, not be the primary way to do things. As a general guideline, which I freely violate in controlled conditions. Professional programmer, closed subnet. Do not attempt.)

Ahem. So Rails has full and easy AJAX support, which means AJAX-y things are easy to do. You might be able to find code libraries in PHP, I don't know. Rails makes it really easy, though. It uses the MVC (Model View Controller) paradigm, and the View part is usually HTML, but it could be Javascript or XML, too. That's where you get half the AJAX functionalitiy.

(Not in the original email:) Rails includes the prototype and scriptaculous javascript libraries, which make AJAX and DHTML tricks very easy.

You may not need to do much AJAX anyway. I see your question stems from trying to speed up a potentially slow Rails app. Where did you hear that Rails is slower than PHP? It could be, but let's examine the bottleneck areas and comparison points:

PHP usually runs as a module of your web server (Apache). That makes the PHP interpreter pretty fast. Rails usually runs off mongrel or something else, which Apache has to proxy to. Apache is a decent web server, having it in front of your Rails server is a good idea. You can remove this bottleneck by running multiple mongrel processes for your Rails app, and have Apache do a load-balancing proxy. This is quite easy to do. Apache config:

    <Proxy balancer://yourapp_cluster>
        BalancerMember http://127.0.0.1:8290
        BalancerMember http://127.0.0.1:8291
        BalancerMember http://127.0.0.1:8292
        Order Deny,Allow
        Allow from all
    </Proxy>
    <Location /yourapp>
        RewriteEngine On
        RewriteRule ^/(.*)$ balancer://yourapp_cluster%{REQUEST_URI} [P,QSA]
    </Location>

(Mongrel listens on the ports in the BalancerMember lines.)

Now, mongrel does take memory, being a separate process. It's not so bad, though. You don't need huge resources, but I wouldn't run a Rails app, or much more than 1 or 2, off a virtual machine.

Speed of actual code: I can't compare. Of course, if you write an O(N^2) sort algorithm, you're screwed either way. (Hint: both PHP and Ruby provide sort functions, but this is only one example).

Database connection: This is likely to be the worst issue. Rails presents your database (DB) in an object-oriented manner, called Object-Relation Mapping (ORM). An ORM is usually pretty chatty with the DB, always asking for table descriptions and so forth. A lot of that can be optimized away, if you're reasonably careful about indexes, eager loading, and how you do your algorithms. Judicious use of periodic database maintenance scripts can help, too, by generating cache tables.

You're trying to optimize prematurely, as you've guessed. I believe Rails can support a pretty busy PBBG, depending on how busy each page is going to be.

Rails is used best on a server where you have shell access. You can set up a development environment on your Windows box, but you'll need a database. MySQL is recommended. For actual use, i.e. production, I recommend a Linux server, Debian preferred, where you have root access. Linode and csoft can give you virtual machines. Despite my earlier injunction against one, initially you can use a VM. If it gets busy, you can switch to dedicated hosting -- if you can make money off it.

Rails development happens with it's built-in web server, Webrick. Once you start it, (./script/server) you connect to http://localhost:3000/ . That's localhost port 3000. Do NOT use that for production.

Oh, if you want to try Linux for a home/development machine, grab an Ubuntu LiveCD: https://help.ubuntu.com/community/LiveCD

Last updated: Nov 20 2008 20:36

Tag: geeky rails