Categories
Article Blog: My thoughts Operating System

Why we don’t need VPS?

Late last year, I was pretty happy to have a budget to take a VPS for my company. This was first server that we own. What a great feeling to have it. But soon the great feeling becomes a nightmare. It was not that hosting company is not that good, it was just that the VPS are not good in general. I am talking about it after using atleast 10 VPS server from 3-4 different companies. Fortunately I invest only in one of them.

Coming back to topic, here are reasons why I hate VPS now:
1. VPS is said to be cheaper, But for whom? You or hosting companies? Companies with good reputation or resources gives a VPS starting at $60 per month for just a 1GB RAM, with 30GB HDD. IF you compare it with Dedicate server with low end they ends up with 160 GB HDD and 2 GB RAM. for about $100. But to get that configuration you need to spend over $100. So comparatively they are not cheap.

2. When I buy a VPS I read that my VPS will be hosted on Cloud network and hence if a VPS fails for some reason it get up again on next node in network and reduce the downtime. Unfortunately my VPS Hosting GRID failed and it dump my data for 48 hrs, before they can fix the node. I was not alone but all people having their VPS on that grid lost valuble 48hrs waiting for their server. Later it took 15 days to get my hosting to move my VPS to new GRID as even after 48 hrs they said they still need to do few maintenance and my VPS will do roller coaster during that time. If I have Dedicated server and if some hardware fails it took less than 2 hrs to get it up live. But if VPS grid’s hardware fails who grid gets overloaded from other VPS and reduce performance. Plus changinge their hardware wasn’t easy. This is what I had experience on my server and unfortunately on client’s hosting when their Hosting [different my mine] fails for them too.

3. VPS should not be confused with Cloud Hosting. VPS are virtual machine, and even if they are hosted on Cloud Network they are not Cloud hosting for your purpose, they are as good as dedicate machine. IF your VPS fails, or shutdown, your website will be down. You won’t get shifted or reboot, becuase machine is down not a network. It is like notepad crashing on your computer. It do not effect computer otherwise. Cloud hosting are like shared hosting, where multiple computers store data, and a data replication happens on fallback node. then your webserver runs on different hardware on same grid and other application as well. So if say one web server fails there are other webserver available to take load of your application. But this is note the case with VPS machines. IF you take VPS you take a 1990’s computer as server don’t expect too much.

4. VPS is a concept of running more than one Operating system on given hardware. Like running Parallel to run Widows on Mac. Though it is been said that they share resources, but actually if you have a computer with 4 GB RAM running 2 VM with 2 GB RAM. do you think you get full 2GB RAM performance? the answer is NO. because at 4GB RAM there are 3 OS running. and one is using 4GB, while other 2 are using 2GB each, so they need 8GB in total, but it is not possible because we have 4GB. So the host operating system scarifice some of his RAM, maybe 3GB but it still be a 5GB. Same happens with CPU processing, Same with HDD. A HDD writes a 1xX speed if it has to write it for 3 OS will it write faster? no it still write 1xX and each os get only 1/3xX of speed.

In nutshell, if you are trying to save money by using VPS, then you better reconsider using a Shared hosting or a Dedicated server. Hosting 10 site on VPS will cost you $6 per month with no performance, where as shared hosting from decently good host will cost your just about same, but much better performance. And if you have enough money why not a Dedicated server or a Cloud hosting like Microsoft Azure, or Amazon S3 like services ?

Categories
Operating System Server Configuration

Classic ASP : Enable Debug mode on IIS7

After a long time today I need to work on Classic ASP website. Ofcourse, it was debugging job and the first hurdle was to make the site running in my test environment where unfortunately I don’t have Debugging for ASP.net enabled. So, I thought to do that by changing my IIS 7 setting so I don’t have to chance it everytime for every project after all it is debug server only.

So here are settings I need to change:

1. Select the Default website in IIS [or website you need to enable debugging].

2. Look for ASP icon, double click open it. In debugging settings check “Send to browser ” and Enable Server side debug to true. Close this dialog

3. Look for Error pages, Double Click open, look for 500 Error page, right click select “edit features”/advance options. Select Detail Error for all modes.

 

Update

Webmatrix (Parent Path):

In case you want to enable parent path for Webmatrix setup, then look for IIS Express icon in system tray and look for “Show all Application”, where you find the applicationhost.config file path. Open it in editor and at bottom of file you will find Configuration Tag for required site location. (Beware there you will find lot of location for all different projects you run through IIS express), just edit the required one and put the configuration from this ticket

Stackoverflow Issue

<asp 
     enableParentPaths="true" 
     bufferingOn="true" 
     errorsToNTLog="true" 
     appAllowDebugging="true" 
     appAllowClientDebug="true" 
     scriptErrorSentToBrowser="true">

     <session allowSessionState="true" />
     <cache diskTemplateCacheDirectory="%TEMP%\iisexpress\ASP Compiled Templates" />
     <limits />
</asp>

That is it.

 

Categories
.NET C#.NET Operating System Programming

Read System TimeZone to DB

I was looking for the TimeZone Database which also need to told me if Given Timezone is DayLightSaving enabled or not. After searching few hours on Internet I found few database that do not tell the Daylight Saving stuff. Then I found a function in TimeZoneInfo class that list all System Timezone, I loop through it and got what I need.

using (SqlCommand sqlCmd = new SqlCommand(“”, Connection.MyConnection))
{
sqlCmd.CommandText = “Insert into tblTimezone (TimeZone, TimeZoneDifference, isDST) Values(@TimeZone, @TimeZoneDifference, @isDST)”;
sqlCmd.Connection = Connection.MyConnection;
sqlCmd.Connection.Open();
foreach (TimeZoneInfo tzi in TimeZoneInfo.GetSystemTimeZones())
{
sqlCmd.Parameters.Clear();
sqlCmd.Parameters.AddWithValue(“@TimeZone”, tzi.DisplayName);
sqlCmd.Parameters.AddWithValue(“@TimeZoneDifference”, tzi.BaseUtcOffset.ToString());
sqlCmd.Parameters.AddWithValue(“@isDST”, (tzi.SupportsDaylightSavingTime ? 1 : 0));
sqlCmd.ExecuteNonQuery();
}
sqlCmd.Connection.Close();
sqlCmd.Dispose();
}

Keep it simple 🙂

Categories
Joyous MySQL Operating System

MySql 5.5 : funny about it

Just saw the release note of MySql 5.5. Looks exciting upgrade, but what looks most funny about the software is the fact that they claim to improve performance by 1500% on windows [some 372% on linux]. Looks great work by them. But I found this information funny, as my some Open source lover friends always claim that because of windows bad structure mysql perform bad on Windows machine as compare to linux. But now my argument to them is if it is bad structure of windows, then how they achieve 1500% improvement by improving their code and not windows ? Often people forgot when comparing software that run on multi platform that the optimization of core software can only be for either OS [if they share same code], and that cause performance issues.

But whatever it is, I am happy to see MySql perform better on windows as I am bound to use windows with kind of resources I can afford for my development and maintainability I can handle.

Good work Team !!!

Categories
Operating System

Ejabbered – Service Failure on Window

Found a fix for this “Error 1075: The dependency service does not exist or has been marked for deletion”

1. Open RegEdit
2. Navigate to this key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ejabberd
3. Under “DependOnService”, change “LanmanWorkstation” to “” (empty string)
4. Reboot

Categories
Operating System PHP Server Configuration

.htaccess Hack

Today, I got another wordpress that stop working and start giving 404 error. Previously client got it fixed by removing .htaccess from his installation and get it working. I thought he might mess his wordpress himself. But when we got similar error today I search and little and find that in .htaccess there is a php injected to wordpress which reside at  “/tmp/25454b22bf39c75795851f39d5e347c4”, after opening the file it looks like professional white script. But knowing computer programmer, only a hacker or idiot can place an important file in /tmp folder. Anyways, I don’t know the cause of hack yet, but I saw following pattern:

1.  Hack is known for wordpress and OsCommerce as of now. [I personnely see only wordpress below 3.0.5 been hacked, rather more specific to 3.0.4 version]

2. Hack need .htaccess file and /tmp folder, so only Linux [can they use windows temp? not know] and surely for Apache user it is an issue.

I cannot say wordpress or oscommerce is broken, but definately there is a control upload script that copy file to /tmp folder which is usually public readable. and then getting .htaccess is problem.

So if you are on Linux/apache and your software does the .htaccess read/write then you need to be beware.

Precaution

1. Make your .htaccess read only by user and group at most not for public

2. Create a empty non writable file /tmp/25454b22bf39c75795851f39d5e347c4 so in case someone try to copy it fails as file already exists.

3. Change your Passwords

4. Upgrade your software to latest version

5. Do not upload any theme or plugin which is not from known or tested source.

6. Look for vendor recommendation before installing any plugin.

Phew, so far my wordpress is safe, been on windows hosting I am sure the hack will be different if any, lets wait and see.

EDIT:  After few days of writing this article I found few instance where I can safely says that it is not a wordpress or OsCommerce hack, but rather a hack related to either Linux Operating System, or Apache Web server or Plesk Control panel. For sites I see this hack only those three are in common. All those site I saw get hacked in above way are not written by one developer, not belong to one server [except they all use plesk and apache], not using only Mysql [do you really thing mysql query can create ,htaccess?]  So, I give Clean chit to any Open source software as of now from this hack. This is indeed a server hack, Still no reason known to me.

Good luck guys !!!


Categories
Article Operating System Server Configuration

IIRF: URL Rewrite, 64bit resolved

Wow, it was hard 48hrs trying to get URL Rewrite for IIS 6.0. Most of solutions are paid and hence not my piece of cake. Especially when I found a great IIRF which is free. However the developer has problem that he doesn’t have 64bit machine to test and fix. Same is with me, but I manage to get a 64bit version of it from original source with almost no change. Here are steps I used to create my 64bit version.

1. Download Latest PCRE version from http://www.pcre.org

2. Download Cmake from http://www.cmake.org

3. Using CMake, I create a Visual Studio 9 64bit Solution from it.

4. Compile PCRE in 64bit.

5. Now download the Latest Source of IIRF from Codeplex (http://iirf.codeplex.com )

6. Open its solution file, change IIRFConfig.c file to by replacing pcre_free function call to free function call [2 replacements only]. [it was otherwise giving linker error to me]

7. Now replace 3rdParty files from your PCRE version [you need to compile PCRE in Release mode only, and make a STATIC Library [by default it is dynamic library, though you need both static and dynamic]

8. Now compile your IIRF version and Bingo!!! it is done, you will get a IIRF in 64bit machine.

Now some interesting facts

1. I use Windows 7 with Visual Studio 2008 to do all this on my 32bit machine only. So I cannot test my build as it won’t run 64bit stuff.

2. I had a 64bit windows 2003 VPS with IIS 6.0 running in 64bit mode, I test it up there and it works.

3. I did all this because I want to move this blog to Windows 2003 64bit. I will do it soon.

Now, your award for reading it out, you can download that 64bit IIRF Release version here