June 2008 - Posts
During a design meeting of a new project the issue of performance is raised.
This is the theoretical (worst-case scenario) performance requirement:

As existing frameworks and 3rd party tools don't match these requirements, new frameworks will be developed.
After spending many men-months on developing new frameworks (even before the development of the application itself) this is the application's performance:

Eventually the application is shipped, and customers are satisfied with the performance.
However, this is the average case performance requirement:

(NIH
= "not invented here", a common syndrome in the software industry
leading to spending resources to create new tools instead of using
existing ones)
Usually I use my desktop computer to surf the web, but recently I decided I want to be able to also use my mobile computer at home, and this require network access.
At first I inquired about using WIFI access, but there is a major downside to this for me: I don't want the router to broadcast a signal while I don't need it (both to save energy and to avoid an extra EM field around the house).
So I thought about using Bluetooth:
- Easy to turn on and off
- Cheap (50-100nis for a BT adapter for my desktop)
I usually use the mobile computer about 6-7 meters from my desktop, through a plaster wall, so that's well within the specifications. I now manage to get 150kb per second download speed, and I'm writing this post from the laptop.
I had few problems establishing the internet sharing, but thanks to the good manager of the Israeli broadband forum at Tapuz I found an excellent guidance document for configuring ICS.
Highly recommended, even for non-Hebrew speakers (as there are screen-shots):
- Setting the server for WinXP (desktop)
- Setting the client for WinXP (laptop)
סערה גדולה קמה במשק בעקבות הרצון של האוצר למסות קרנות השתלמות (בתמורה להפחתת מס הכנסה). אישית אני מתקשה להבין את ההפתעה הגדולה כאן - הרי הטיעון העיקרי של האוצר כשיזם את הרפורמה בליסינג (שעומדת לפגוע משמעותית בעובדי הייטק בשנים הקרובות) היה שההטבה הקיימת אינה שוויונית, ומטעמי שוויון יש לבטלה.
אני התנגדתי לרפורמה הזו, כשתשובתי לטיעון הזה הייתה שמערכת המיסוי אינה שוויונית מטבעה (מיסוי פרוגרסיבי), ושאם רוצים לבטל הטבות הניתנות רק למגזרים מסויימים, הרי שבאותה מידה צריך לבטל את קרנות ההשתלמות, שמהוות הטבה שאינה זמינה לכלל ציבור העובדים:
ממתי מערכת המיסוי שוויונית? אדרבה, תבטל גם את קרנות ההשתלמות (לא כולם מ קבלים את מקלט המס הזה) ואת גביית השכר הדיפרנציאלית, נראה אותך.
ונחשו מה? כנראה הלוגיקה שלי דומה לזו של האוצר. וההסתדרות ששתקה בזמן שהעבירו את הרפורמה בליסינג פתאום מתקוממת.
כשנותנים יד לפגיעה במגזר יצרני כמו עובדי ההייטק, מה הפלא שבשלב הבא נפגעים מגזרים אחרים?
(* לפחות בר-און זנח את הרעיון של ההפחתה במע"מ, מהלך שמועיל אך ורק לבעלי עסקים)
אני חייב להודות שעקבתי בהשתאות אחרי ההיסטריה בימים האחרונים סביב ההכרזה על הדור הבא של אייפון: מבול הודעות בנושא בטוויטר, אתר TechCrunch קורס מהעומס, בלוגרים שונים מסקרים את הארוע (כולל באתר הזה).
לא ממש הבנתי את ההיסטריה.
בסה"כ מדובר על שדרוג לא משמעותי במיוחד (אפילו המצלמה לא שופרה) לגדג'ט פופולרי, שאינו בהכרח הטוב ביותר בתחומו.
בכלל, קיבלתי לאחרונה תחושה שגיקים שההורים שלהם לא קנו להם נייק בתיכון ולכן הרגישו פחות מקובלים מרגישים שמוצרי אפל הם הסמל סטטוס החדש - וזה מגיע למצב בו אפשר לראות אנשים שמים תמונות פרופיל בפייסבוק שלהם עם המק-אייר (המחשב הנייד של אפל).
אולי אני נאיבי, אבל דווקא מהקהילה הזו ציפיתי ליותר חשיבה מפוקחת והשוואה למוצרים אחרים בשוק לעומת הנהירה שראיתי. אין ספק שמוצרי אפל מצויינים בכל הנוגע לעיצוב וממשק משתמש, אבל לא מדובר בדיוק בייתרון של שנות אור על המתחרים, ובחלק מהמקרים התכונות של המוצרים האלה נחותות בהשוואה לאלטרנטיבות.
וכמובן קיימת העובדה של היחס המזלזל של אפל בשוק הישראלי. גם אחרי שיש לנו יבואן יורש ל"ידע" הזכורה לרע, עדיין מסתבר שאפל מרגישה נוח להודיע על שחרור האייפון החדש בליכטנשטיין לפני ישראל.
שלא תבינו אותי לא נכון - האייפון הוא גדג'ט חמוד מאוד עם כמה יתרונות נחמדים, והמק-אייר הוא מחשב נייד איכותי. אבל מדובר בסה"כ בעוד גדג'ט ועוד מחשב נייד. כולנו אנשים בוגרים, וקצת יותר ציניות לא תזיק לאף אחד, בטוח שלא לאפל.
After creating a custom UDP mulitcast channel using WCF I ran some tests. I used this sample data contract class:
string Name
string Description
ushort Id
double X
double Y
double VX
double VY
uint Flags
DateTime CreatedTime
DateTime UpdateTime
Benchmark Results:
-
Max amount of sent objects per second using 100mbit hub (using Intel 3Ghz HT CPU - not dual core): 46000
-
CPU load during peak sending - 15-25%
-
Effect of zip encoding - 50% less bandwidth with random values (probably 60-70% reduction in a real-world scenario)
-
Sending 10000 objects per second - no significant CPU load (3-5% for both apps), GC load - less than 0.5%
I recently needed to build a WCF UDP application as a proof of concept.
Sadly UDP is not among the channels bundled with the WCF, so I needed to put up something myself:
-
-
-
Added the extensions section to the config file to add the UDP support (config file coming up soon)
-
Added multicast="true" switch to the binding section
-
The address prefix is hardcoded in the UdpChannelHelpers.cs file, so if you like something other than "soap.udp" you need to edit the "Scheme" constant.
-
You need to remember that since this is multicast, the client is the one doing the transmitting while the service is a only a passive listener.
Client configuration:
<configuration>
<system.serviceModel>
<extensions>
<bindingElementExtensions>
<add name="udpTransport" type="Microsoft.ServiceModel.Samples.UdpTransportElement, UdpTransport" />
</bindingElementExtensions>
<bindingExtensions>
<add name="sampleProfileUdpBinding" type="Microsoft.ServiceModel.Samples.SampleProfileUdpBindingCollectionElement, UdpTransport" />
</bindingExtensions>
</extensions>
<client>
<endpoint address="net.udp://225.225.0.1:2222/Observer/"
binding="customBinding"
bindingConfiguration="DatagramServer" contract="MyNamespace.IObserver"
name="ClientService" />
</client>
<bindings>
<customBinding>
<binding name="DatagramServer">
<binaryMessageEncoding></binaryMessageEncoding>
<udpTransport multicast="true" />
</binding>
</customBinding>
</bindings>
</system.serviceModel>
</configuration>
Service configuration:
<configuration>
<system.serviceModel>
<extensions>
<bindingElementExtensions>
<add name="udpTransport" type="Microsoft.ServiceModel.Samples.UdpTransportElement, UdpTransport" />
</bindingElementExtensions>
<bindingExtensions>
<add name="sampleProfileUdpBinding" type="Microsoft.ServiceModel.Samples.SampleProfileUdpBindingCollectionElement, UdpTransport" />
</bindingExtensions>
</extensions>
<services>
<service name="ObserverService.Observer">
<endpoint address="net.udp://225.225.0.1:2222/Observer/"
binding="customBinding"
bindingConfiguration="DatagramServer"
contract="MyNamespace.IObserver" />
</service>
</services>
<bindings>
<customBinding>
<binding name="DatagramServer">
<binaryMessageEncoding></binaryMessageEncoding>
<udpTransport multicast="true" />
</binding>
</customBinding>
</bindings>
</system.serviceModel>
</configuration>
The application I'm working on is a C4I, GIS based application, originally written in framework 1.1.
Recently we did several tests to prove the improvements derived from upgrading to framework 2.0 (or 3.0) without doing major changes in the base code. The performance improvement focus was on switching to Generics for collections containing value types.
Possible pitfalls - mostly the usage of Hashtable and other 1.1 collections, which tend to return NULL when the key is not found. Unlike them, the Dictionary class and similar generic collections tend to throw exceptions if the key is not found. This requires adding calls to the ContainsKey method to prevent these exceptions. Nothing complicated, but a lot of manual labour.
Performance improvements (also with some minor refactoring):
- CPU usage in heavy-load-scenarios was reduced by 10-20%
- Time in GC (as measured by perfmon) was reduced to half of the previous value
Justin-Josef Angel is leaving Israel and moving to Canada.
For the occasion I decided to republish Eran's comment to a post I wrote some months ago:
Times have changed,
our kids are getting worse,
From sending simple text messages they turned vampire bytes and alcohol shots
Should we blame the government?
Or blame social networking?
Or should we blame the images on TV?
No,blame Canada, blame Canada
With all their beady little eyes have packed their heads so full of lies,
blame Canada, blame Canada,
we need to form a full assault, its Canada's fault