josephbill.com

Node.js Performance Benchmark on Windows vs. Linux

without comments

The benchmarks below were performed with Apache Benchmark (if you’re wondering like I did, Apache Benchmark comes with Apache, ab.exe in the bin folder) using Amazon EC2 with extra large instances (4 cores, 15GB memory) with 10,000 requests and 10 concurrent users. I kind of knew that Linux would be faster than Windows but I didn’t think it would be twice as fast.

Node.js using cluster:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var cluster = require('cluster');
 
if (cluster.isMaster) {
 
// Count the machine's CPUs
var cpuCount = require('os').cpus().length;
 
// Create a worker for each CPU
for (var i = 0; i < cpuCount; i += 1) {
cluster.fork();
}
 
// Code to run if we're in a worker process
} else {
 
var http = require("http");
 
function onRequest(request, response) {
console.log("Request received.");
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}
 
http.createServer(onRequest).listen(8888);
 
console.log("Server has started.");
}

Microsoft Windows Server 2012 Base Extra large instance 64 bit 4 cores 15 gb memory

Concurrency Level: 10
Time taken for tests: 2.496 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1120000 bytes
HTML transferred: 110000 bytes
Requests per second: 4006.38 [#/sec] (mean)
Time per request: 2.496 [ms] (mean)
Time per request: 0.250 [ms] (mean, across all concurrent requests)
Transfer rate: 438.20 [Kbytes/sec] received
 
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.3 0 16
Processing: 0 2 5.7 0 47
Waiting: 0 2 5.4 0 47
Total: 0 2 5.8 0 47
 
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 16
95% 16
98% 16
99% 16
100% 47 (longest request)

Ubuntu Server 13.04 Extra Large Istance 64 bit 4 cores 15 gb memory

Concurrency Level: 10
Time taken for tests: 1.176 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Non-2xx responses: 10000
Total transferred: 4800000 bytes
HTML transferred: 2770000 bytes
Requests per second: 8501.15 [#/sec] (mean)
Time per request: 1.176 [ms] (mean)
Time per request: 0.118 [ms] (mean, across all concurrent requests)
Transfer rate: 3984.92 [Kbytes/sec] received
 
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 0 1 0.3 1 10
Waiting: 0 1 0.3 1 10
Total: 0 1 0.3 1 10
 
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 2
98% 2
99% 2
100% 10 (longest request)

Written by Joe

July 21st, 2013 at 10:35 pm

Posted in Programming

Modifying Magento TheFind Module To Actually Work

with 5 comments

There are a number of features that are included with Magento (I am currently using 1.5.1) but don’t work out of the box. As I am starting to learn, Magento is known for adding new bugs for every new release. One of those new bugs I believe was added to TheFind.

I got TheFind configured by following the great directions here. Then I published all of my products to TheFind but it wasn’t working cause I was getting an error about the product and image URLs. So I downloaded the feed from TheFind through FTP and I noticed the product URLs and image URLs are relative. There’s probably a better solution to this but I don’t have a lot of time so I came up with something as quick as I could.

So here is what you need to do:

1. Configure TheFind by following the steps here.

2. Change this line in /app/code/community/Find/Feed/Model/Import.php:

111
112
113
foreach ($attributes as $key => $value) {
    $attributesRow[$key] = $product->getData($value);
}

To this:

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
$image_count = Mage::getModel('catalog/product')->load($product->getId())->getMediaGalleryImages()->count(); 
 
if($image_count == 0)
{
    continue;	
}
 
foreach ($attributes as $key => $value) {
    if($key == "Page_Url" || $key == "Image_Link" || $key == "Brand" || $key == "Condition")
    {
        switch($key)
        {
            case "Page_Url":
                $value = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . $product->getUrlPath();
                break;
            case "Image_Link":
                $value = $product->getImageUrl();
                break;
            case "Brand":
                $value = $product->getAttributeText('manufacturer');
                break;
            case "Condition":
                $value = $product->getAttributeText('condition');
                break;
        }
 
        $attributesRow[$key] = $value;
    }
    else
    {
        $attributesRow[$key] = $product->getData($value);
    }
}

You can also download the file here: Import.zip

You will notice that I am including manufacturer and condition, not because they are required, but because it’s always better to include as many attributes as possible to get better rankings (at least that is the way it is with Google). These attributes were appearing as IDs instead of their text versions. You may also notice that I am checking to see if an image exists since TheFind requires them and I was getting an error from products that don’t have images.

Want to learn how to get free traffic from Google to your Magento store? Checkout The Keyword Academy, the place that taught me how to make $50k/year with free Google traffic. Contact me here if you’d like to learn more.

Written by Joe

September 6th, 2011 at 8:03 am

Posted in Magento,Programming

Tagged with ,