Network Performances

November 13th, 2011 No comments

I recently faced a network-related problem, where TCP communications between two servers were particularly slow.

A Customer of mine is running both SugarCRM and MySql on the same (Windows Server 2008) machine. Since they’re collecting a large number of records and a huge number of attachments, I suggested them to move MySql to a new Linux Server, to ease the Windows Server. So we took an amazing HP Server with two esacore processors and 12GB of RAM, running Ubuntu Server 10.04 LTS x64 : not bad, isn’t it ?

After the initial setup we changed the test environment, making it point to the new database server and…surprise !! It’s significantly slower than the production !

We solved the problem  changing a bunch of recurring procedures we built on top of standard Sugar’s objects, substituting them with direct queries on the database.

Clear enough, the main difference is the Network latency: every query issued by SugarCRM now have a small amount of time around itself… and if Your pages are heavily dealing with the database, You better avoid standard SugarCRM objects.

Ok, but can a 1Gb connection really kill performances in this way ?

To answer this question i made some test with iperf, a Network Performance Testing Tool available for both Linux (it’s in the standard ubuntu and CentOS repositories – just apt-get install iperf) and Windows (You can download xjperf from here – remember You’ll need JRK installed, since it’a GUI Java program). Test a Network Connection between two machines with iperf is really simple.

On the first machine, that we’ll call Server, You need to issue the following command:

iperf -s

On the second machine, the Client, You have to issue the following command:

iperf -c <ipaddress>

(where <ipaddress> is the Server machine’s IP Address – or a computer name, if resolved by a DNS).

In this way You’ll test the speed of TCP data generated by the Client for the Server. Inverting the commands, You can test the flow in the opposite direction. If using xjperf, You can do the same through the GUI.  Of course You can do the same test between iperf and xjperf: this would be the case of a test between a Linux machine and a Windows machine.

I made a number of tests between a bunch of machines running Linux (Ubuntu 10.04, CentOS) and Windows (XP, Seven, Server 2008), on both 100M and 1G Network Connections. Tests were made both with a Cross UTP5e cable directly connecting the machines and a connection through a dedicated switch (actually there’s no difference). The following table shows the range of speeds I reached (in % of bandwidth):

  • Linux to Linux : 90% – 95%
  • Linux to Windows : 80% – 89%
  • Windows to Linux : 40% – 60%
  • Windows to Windows : 30% – 40%

The first test I made was Linux to Linux. The second one was Linux to Windows. The third one was Windows to Linux. At this point I was stuck : I repeated it many times, always with the same results. I couldn’t believe at them !

Finally I’ve found the trick: it’s named “TCP Window Size”. Watching the iperf log, You can see its value: in my case was 85Kb for Linux and 8/16Kb for Windows. Increasing it to 56Kb (iperf let You do this temporary change) on Windows side, bandwidth occupation goes straight to 80%-90% !

Unfortunately this is not a definitive solution: starting from Windows Vista this parameter (formerly in the registry) is no more customizable.

What about Your machines ? Will You try this simple test ? If so, will You share Your results/considerations ?

Categories: Networking Tags: , ,

A New Challenge

October 31st, 2011 No comments

My everyday job leads me to work mainly on SugarCRM, writing analysis, building new modules, implementing customizations and, last but not least, study new SugarCRM’s patches and releases (looking for changes on the core).

Since I moved to a small town (Lauriano, near Turin – 1500 souls) I started getting involved in the local touristic association. And here I faced with my new challenge : building a (simple) new web site for them (actually us…).

I consider this as a challenge, simply because I never built an entire web site: I’m not a designer, and I guess I’ll experience some problem on the graphical side of the job…. Of course I’ll be open to Web Designers and Developers willing to cooperate on this funny project : if You want to help, drop me a line… I just can guarantee that no one will earn money from this project (we are all volunteers) : only fun and (maybe) a bit of visibility on this crazy world…

After some test with Joomla and Drupal, I decided to realize this website with WordPress, because I consider it simple and powerful enough to satisfy the (small) requirements of the organization (such as publishing events-related articles, photos and videos, or link to Twitter and facebook accounts).

The real challenge is learning the WordPress framework, to build custom plugins needed by this web site;  plugins that I’m planning to freely share with others (once done, of course !).

Stay tuned, for updates on this project…

Categories: Software, Wordpress Tags:

SugarCRM CodeSprint 2011 in Munich

October 9th, 2011 2 comments

For the first time I had the honor to be part of a SugarCRM’s Code Sprint (this time in SugarCRM Munich HQ)… It was an amazing experience, that I definitely want to live again.

For those wondering what a SugarCRM Code Sprint is, I’m going to explain it with the following (personal) interpretation:

Take a Community Manager, a bunch of Sugar’s Engineers and a reasonable number of developers from almost everywhere in Europe. Put them all in a room, feed them with good (not exactly healthy) food (from Mars and Sneakers to meat and pizza) and beverages (from water to beer, through RedBull), make them feel like home and let them have fun at night. All the rest is automatic: new friendships and good code.

 Don’t know if I contributed with some actually “great” piece of code; I just know I did my best, having lot of real and sane fun (just like when I was young, and software was fun, not work !).

Code Sprint is not a race, you don’t need to be the fastest or the best or the first. You just need to cooperate with others, giving what you can to help building a better SugarCRM. The guys I had the pleasure to meet (and to work with) in those days are all brilliant developers and amazing code contributors (actually they are also younger than me, but that’s another story), perfectly integrated in SugarCRM’s world. Going over those geeks stuff, I firmly believe that this CodeSprint has been a great starting point for new friendships.

[Personal Note]

In the last four days I feel I dramatically improved my (poor) English, especially my (very limited) listening capabilities. I think that the biggest problem I had was the “tuning” of my ears, to understand so many different ways to same the same things (with speakers from Belarus, Belgium, France, Germany, Portugal, Russia, Spain, UK, USA): unfortunately I not always succeeded in that, sometimes looking a bit dumb. But I’m keep on improving…

Categories: Software, SugarCRM Tags: ,

TUSW Philosophy

September 12th, 2011 No comments

When I first started working on SugarCRM I spent a lot of time digging the code, trying to understand how Sugar’s guys coded their standard stuffs and how I could insert my custom code, to satisfy my Customer’s requirements.

I discovered a lot of entry-points for custom code, that would let me create almost any kind of custom procedure without changing the core code : amazing ! Doing customizations without modifications at the core means don’t have to worry about core upgrades… I had just discovered the Upgrade-Safe way to do customizations.

For my personal use I’ve coined the acronym TUSW (The Upgrade Safe Way) to always remember (to myself and to my colleagues) the Rule #1 that all of us should (must) apply to SugarCRM customizations. Think of it like a stamp we put on our analysis.

Since then, I always worked in that way (TUSW) avoiding any (unnecessary) change to the core. But what when there’s no way to do customizations in this way ?!?!?!

Core changes are definitely a bad habit that throw developers in the “patches hell” (definition stolen from MS world, when we were dealing with the sadly well known “DLL Hell”) : whenever SugarCRM publish a new patch/upgrade, developers must check it for changes possibly involving the same (core) files they modified. No way, it’s too BAD !.

So I started opening bugs and feature requests  (at SugarCRM’s Bug Tracker), suggesting SugarCRM people new ways to open up their procedures to customization. At the beginning I was only “suggesting”, while today I’m actively cooperating in development (through the gitHub repository open to all the Community Members or the gitHub repository open to Partners).

Knowing that in a future patch I’ll get the desired functionality, I can implement it immediately (even in a previous release, if the fix is not too heavy), quickly solving the customer’s need, with no risk for my customization.

Categories: Software, SugarCRM Tags:

SugarCRM CodeSprint : I’ll be there !!!

September 10th, 2011 No comments

Excited. Thrilled. I guess my (English) vocabulary is not rich enough to define the amazing experience I’m going to live: the SugarCRM’s Code Sprint, that will be held in Munich during the first week of October.

I don’t have yet detailed knowledge of what will happen during those days. I just know that I’ll be working on SugarCRM’s source code with a selected group of developers coming from USA and Europe, both from SugarCRM and Partners.

During these four days I will meet again (almost) all the people I first met in San Francisco (during SugarCon 2011) and I’ll also meet “live” the people that, today, I know only “virtually” (meaning by eMail or Skype). In both cases it will be a great pleasure !

Now, I have to say two big “Thank You”. The first one goes straight to SugarCRM’s guys, for the event’s invitation they sent me.

The second one (it’s actually a very big “Thank You”) goes to my Bosses at Poker S.p.A., for financing my transfer (even if, in Italy, it’s a bad time for economy in general) letting me take part on this amazing meeting.

I just hope to be a good contributor, to save Poker’s honor (and also mine…).

I will post about SugarCRM’s Code Sprint, so…. Stay Tuned !!!!

Categories: Software, SugarCRM Tags: ,

SugarCRM’s Logging Capabilities

September 10th, 2011 No comments

One of the first SugarCRM’s capabilities I’ve learned was the Logging Engine. It helped me understanding the flow of procedures and it could be powerful as debugging, when you are dealing with  function calls and parameters value.

The logging engine offers several levels of detail:

  • Debug
  • Info
  • Warning
  • Deprecated
  • Error
  • Fatal
  • Security
  • Off

While in a production environment you would set it at higher levels, such as fatal or error, during development you would obtain detailed informations putting it at debug level.

Don’t forget to remove useless (for production scopes) debug informations, or you’ll run into serious performance issues.

First of all let’s see how you can put informations into the logger (it will write them in a file named sugarcrm.log*). The syntax of the call depends on the weight you wanna give to the information:

$GLOBALS['log']->info(“My Debug Info”);

In this example I’m writing into the log file the string “My Debug Info” whenever the PHP interpreter reaches this line of code, and if SugarCRM is configured to track logging at info level or above (meaning info, warning, deprecated, error… But not debug).

Writing a static string would help us understanding the flow of the procedure, but usually we need more:

$GLOBALS['log']->info(“MyVar value : ” . $myVar);

In this example we accomplish two tasks: we track the procedure flow and, at the same time, we get the $myVar value. But what if the $myVar is an array (or an object) ? Here’s the solution:

$GLOBALS['log']->info(“MyVar value : ” . print_r($myVar, true));

Hey, pay attention ! Since print_r function contribute to build the string parameter, it’s actually evaluated before the logging engine knows whether or not to write it on the log file. So you are asking the PHP interpreter to do a hard work (consider that logging a SugarBean object, such as Accounts, can easily write 100 Kb of data in your log file !). Do you think this kind of logging would be useful at production time ? I guess no….

To avoid performance issues and useless wasting of logging time, before going production remember to:

  1. Remove deeply technical log calls (unless useful also in production environment).
  2. Remove long text (such as the one generated by print_r) log calls (unless really useful also in production environment).

* – The standard name is sugarcrm.log, but administrators can opt for a different name through the System Settings link in Administration Menu.

Categories: Software, SugarCRM Tags:

Passion Lives Here

September 5th, 2011 No comments

I’m a passionate software developer, a technology enthusiast, a curious user, a “half” hacker. A geek, if You prefer.

I love my job, so I’m lucky.

This passion (and my work) led me to learn a lot of tech stuff: developing in a number of different languages, managing different Operating Systems, dealing with various databases. And there’s more : I can’t stop from keeping on learning. Too curious, too hungry… Too geek !

Now, I decided to start this new experience : managing a blog.

During last year, my life has considerably changed : I started working (as a “bronze” partner) with SugarCRM‘s guys. Becoming “international” is a great experience, especially for an Italian developer.

Working with them (one for all : John Mertic, the Community Manager), taught me how to deal with large and decentralized organizations. Amazing, even for a (seasoned) developer used to work in a (relatively) small Italian software house.

I use to deal with Open/Free Software (I’m a big Linux fan), so I know how important knowledge sharing and collaboration are. Getting directly involved in Open Source projects, just emphasized this conviction.

This is what this blog is about : sharing experience, knowledge and news from this fast-growing world of technology.

I choose to write my posts in English because I consider it a good exercise to improve my skills. Feel free to comment not only on the content, but also (mostly ?) on the grammar/syntax : this will surely help me improve !!!!

Categories: General Tags: