Logo




Subscribe:
RSS 2.0 | Atom 1.0
Categories:

Sign In


[Giagnocavo]Michael::Write()

 Wednesday, March 16, 2005
SOAP Performance (gSOAP / ASP.NET)

I'm doing my own realtime support for Asterisk, in an attempt to make it scale. Asterisk is nice software, but straight out-of-CVS, the performance for high volume (say, over 20,000 clients) sucks. There are also other inconviences with using a file-based store to determine how to route calls. Mainly, it's inflexible and hard to achieve high-perf when everything is based on a large .conf file. Not to mention that Asterisk uses linked lists for everything so looking up any user is an O(N) op (and parsing the users file is O(N*N) by default!). So, I'm going to put my own logic as a replacement for some of the critical parts.

One of my concerns was performance. Since I'll have multiple Asterisk clusters banging on my .NET code (via SOAP), I wanted to ensure the whole end-to-end process was fast enough.

I used gSOAP to create the C code on Linux. gSOAP is seriously nice. At least an order of magnitude easier to use than I expected any SOAP library that works on Linux would be.

I created a simple test. I made a database with phone numbers and codecs. The idea is that when an incoming call comes in, Asterisk will use my code to SOAP over to my Windows machines, get the data, and then go on its merry way.

My Asterisk machine is a P4 2.4GHz, 512MB RAM (but, I have a Gnome session running on it). My Windows XP machine (I tested against my desktop) is a P4 3GHz HT, 1.5GB RAM. I'm running ASP.NET 2 Beta 1 and SQL Server 2000.

The test program consists of a loop (count 5000) that generates a random number, then uses gSOAP to ask for the codec for that number. Simple, tight.

The results on Linux are particularly impressive. Each instance of the test app only used a max of 4% processor, and under 1MB of RAM. The bottleneck was definately inside ASP.NET. To simulate more load from other machines in a cluster, I ran 1, 2, and 4 instances of the test program. Also note that background tasks on the XP machine used up about 10% of the CPU.

Results:
 Single process (5000 total requests): 
  Total time:                   18 seconds (0.0036s/request)
  Requests per second:   277
  ASP.NET/IIS CPU:          30%
  SQL Server CPU:            4%

 Dual process (10,000 total requests):
  Total time:                   23 seconds (0.0048s/request)
  Requests per second:   384
  ASP.NET/IIS CPU:          60%
  SQL Server CPU:            7%

 Quad process (20,000 total requests):
  Total time:                   42 seconds (0.0052s/request)
  Requests per second:   476
  ASP.NET/IIS CPU:          80%
  SQL Server CPU:           10%

These results are encouraging enough that I'm not worried of the performance impact of using SOAP with Asterisk. My target was to have a response in less than 0.1 seconds. Although, anything under 0.5s would be quite unnoticable to a client. Even in tests with more threads, my single request response time was always way under 0.1 seconds.

Also, as far as I know, Whidbey Beta 2 (the version I'll go live with) makes some performance improvements. And also, IIS6 on Windows 2003 is much faster than IIS5.1 on XP. At any rate, a single proc desktop machine serving 476 RPS? That's pretty damn good perf if you ask me!

ast_mono | Asterisk | Code
Wednesday, March 16, 2005 5:06:55 PM UTC  #    Comments [1]  |  Trackback

 Sunday, March 13, 2005
A PETITION TO END THE ATROCITIES OF VISUAL BASIC

[OK, this was brought on after a night of fighting with the latest VS2005 “Made For Mort(tm)“ features in VS2005 and after hearing even more about the silly “VB Unmanaged 4Ever Petition“. Yes, I know, there are professional, intelligent, etc. VB programmers who signed. I also started programming in BASIC. And yes, I know this suggestion is as bad as the actual petition.]

Sign by leaving a comment.

A PETITION TO END THE ATROCITIES OF VISUAL BASIC

We would like to suggest a
path for the future development of VB6 and similar apps to put an end to the crimes against the world committed by worshipers of Microsoft's product, Visual Basic. This path will help anyone who should be working with computers on a technical level.

OBJECTIVES

We ask that Microsoft stop catering to low-end, “Mort” developers, especially those who cling to past glories achieved through VB6.

1. Preservation of Assets
    Microsoft should not:
        - Force customers to uninstall Visual Basic 6
        - Push a patch out through Windows Update that disables the VB6 runtime
        - In any way, magically make VB6 stop working at the end of March, 2005

2. Discontinued support for Visual Basic
        - Medical trials have shown strong correllation between Visual Basic usage and degration of the brain, notably the areas that deal with change and improvements.
        - Microsoft should take responsibility and make its products harder to use to raise the level of entry.

3. Ease migration of deprecated developers

        - Provide “Career Days” where developers can learn about and get jobs in exciting industries, such as textiles and hospitality
        - Promote local support groups and 12-step programs
        - Sponsor emigrant visas 
        - Provide a VB6-to-C++ reverse engineer tool.

SUGGESTED APPROACH

We believe the best way to meet these objectives is to drop support for VB.NET after Visual Studio 2005 (Codename “Whidbey”). For brevity, we’ll call this “natural selection”.

To quell proponents of “VB.COM”, we suggest explaining that “VB.COM” and “VB.NET” are so completely unlike C# and C++ that it sounds like a bad joke. We also suggest that Visual Studio team members personally make disparaging comments about how silly this is. While personal attacks and racial slurs shouldn’t be used, general stereotypes such as “…people who think architecture means making a wrapper for MsgBox” are fine.

CONCLUSION

With VB.NET out of the picture, less “Morts” will use Visual Studio. Microsoft can then focus on designing a strong framework and toolset that doesn’t worry about people who won’t understand why System.Windows.Forms.MessageBox.Show doesn’t work “as it should” in an ASP.NET page.

Overall, we feel this will enable a better environment, and more robust software being created in the industry today.

Humour
Sunday, March 13, 2005 4:25:54 AM UTC  #    Comments [13]  |  Trackback

 Friday, March 11, 2005
What the "Classic VB Petition" really shows
http://classicvb.org/petition/

So, they're not only asking Microsoft to create a new version of old VB (i.e., not .NET), but they're also asking it to be integrated into the VS.NET v8+. Some have cited C#/C++ as an example of this. 

HAHAHA! Man, if this doesn't show how clueless some VB programmers are, nothing does. I mean, seriously, come on! They actually expect MS to say “ok, sure we'll make VB6.5 v2005 and go away from managed code”? And they think that integrating VB6 right into VS.NET will be a piece of cake? This proves that many VB devs really are clueless when it comes to designing apps and think that there's some magical power that just makes everything work. The sad part of this is that some of these people are MVPs... I thought that MVPs generally had a relatively high knowledge level and wouldn't come up with silliness like this...

Humour
Friday, March 11, 2005 4:53:14 AM UTC  #    Comments [13]  |  Trackback

 Saturday, February 26, 2005
Fixing SQL Server 2000 SQLDMO after 2005 Uninstall

Ran into this problem after uninstalling MS SQL Server 2005 beta and trying to open the Enterprise Manager: “SQLDMO has not been registered. Please re-install SQL Server and try again.”

Just go into C:\Program Files\Microsoft SQL Server\80\Tools\Binn\ and run “regsvr32 sqldmo.dll”. Things will work again.

Misc. Technology
Saturday, February 26, 2005 4:30:27 PM UTC  #    Comments [4]  |  Trackback

Smart change to TransactionScope

In .NET 2, there's a new System.Transactions.TransactionScope class. It basically allows you to do implicit transactions just by creating a new TransactionScope. It's stored in TLS and things like SqlConnection check it and auto-enlist. A sample:

using (TransactionScope txScope = new TransactionScope)
{
insertSomethingIntoDB();
processCreditCard();
txScope.Complete();
}

This is different than Beta 1. In Beta 1, you had to set txScope.Consistent = true (it was implicitally false). I feel this is a great change, as using a method for completing a transaction is a lot more intuitive than using a property. I bet a lot of people would have run into errors with the old behaviour. Now, it's quite clear. When you're ready to commit, just call Complete. If you don't want to commit, then call Dispose (implicit with the using block).
Code
Saturday, February 26, 2005 4:24:30 PM UTC  #    Comments [1]  |  Trackback

The REAL Visual Studio users

I got tired of seeing, smug, designer people used in advertising VS. So I decided to modify the “professionals” you see here: http://lab.msdn.microsoft.com/express/, to something that perhaps more accurately represents the user base of those products:



Edit: I didn't mean to pick on the Express line in particular actually. It's just that they had all these models lined up. I think of some of the images apply to ALL versions of the product... (like the first one? ;)).
Humour
Saturday, February 26, 2005 9:14:50 AM UTC  #    Comments [5]  |  Trackback

Uninstalling Visual Studio 2005 December CTP

Control Panel -> Add/Remove Programs
Remove VS.NET 2005, MSDN, J#, Device Emulator, etc., and .NET Framework 2.0.

Then delete VS8, 2.0 Framework folders and registry keys.

That seems to do it. Beta 1 installed, without rebooting, without complaining, right after that. Of course, maybe it'll blow up when I start working, so no guarantees. But it's sure a huge improvement than Beta 1's uninstall.

Code
Saturday, February 26, 2005 8:41:54 AM UTC  #    Comments [1]  |  Trackback

VS 2005 December CTP Feedback: Rollback to Beta 1

So, after about 6 hours of trying to install, I've gotten the VS 2005 December CTP installed. I can say that the December CTP has made a lot of progress. Some things are a lot faster (say, ASP.NET building). A lot of stuff feels unpolished (icons). Some things are silly: F7 (“View Code“) is broken... had to manually set it. At any rate, I'm gonna come out and look like a dumbass, since I'm now gonna spend n hours re-installing Beta 1 :P.

One kick ass thing is that the dialogs are FAST now. Before, it seemed like old Windows Forms: you could see things painting (the refactoring dialogs are a good example). Now, it seems like real Windows. There other code editor enhancements (I noticed some new error colours)

Some stuff is just unusable. Like, I don't know... say, building and viewing errors. For some reason, I had to build about 20 times to get through all the errors. And no, they were not errors that stopped a file from compiling that need to have a rebuild, nope. Just simple things dealing with ASP.NET.

I get obsolete warnings, saying I should move to other classes (ConfigurationManager)... but these classes don't exist. So there goes compiling with warnings as errors :). No big deal.

Typed Data Adapters got some changes. Typed data adapters now have Connection[String]? as a protected field (as far as I can tell), breaking my code, forcing me to do changes (subclass the adapter) for no reason, other than to annoy me. Yea, it's all one gigantic cosmic plan to screw up my project ;).

What the hell is the obession with naming a freaking connection when “designing“? Data adapters, web services, etc.: I wanna link all that up at runtime. But no, it insists on having me select a “connection“. Then it dumps it into an app.config (even for library projects). What ever happened to “the developer has some clue of what he's doing, so let him handle it“? I understand that script kiddies are customers too, and sometimes you just drag and drop and presto: a full data app. Hey, I write one-off code sometimes too.

ASP.NET is still in transition here. First, it bitches about having a bin and Application_Assemblies directory, forcing you to rename (since you can't delete the Application_Assemblies dir). Of course, they have now realised this was retarded and fixed it (called it bin) in future builds (Beta 2). They also went though another fit with the directives (CompilesWith, CodeFile, CodeBehind, Inherits, ClassName... wtf?). Fortunately, it looks like they're going a step in the right direction. Of course, since I had so much trouble even getting my project to build, I could be wrong. Even so, it tossed out my old project settings (since Web Projects aren't projects, they're just folders).

There's been a lot of work invested in making it more “Community” accessible. That's all fine and dandy, but I can't envision myself ever, ever, using any of those features. Perhaps for VS Express/Academic/I-learned-VBA-and-thus-am-an-Enterprise-dev versions it makes sense. Just not sure what place it has in “Enterprise Architect” version.

Of course, I was forewarned that the CTPs weren't good, and that Betas are real quality, etc. etc. But, hey, I like being hopeful. And it's a good glimpse of the future. Too bad I couldn't use it and file more reports against stuff. I'll have to wait until Beta 2. :(

Code
Saturday, February 26, 2005 6:59:02 AM UTC  #    Comments [0]  |  Trackback

Visual Studio 2005 Install Errors (1304)

Well, I'm upgrading from Beta 1 to the December CTP, since my friend (who works on VS) insists that it's 150% better than the Beta. We've run into some issues, and I hope that December CTP will solve them (since no Beta2 was released today, as far as I know :)).

I was getting an error: 1304 Access denied on SdmCompile.dll. It tells me to check the path, but doesn't provide a path. Searching the whole system didn't find it. So, I went into the DVD and tried to install the .NET 2.0 Framework by itself - aha! It said “A previous product is installed....”. Even though I had already uninstalled everything.

All help pointed to a tool called MSIINV.EXE. Well, that's not public, and I didn't feel like calling PSS (why it's such a dangerous tool is beyond me, since MSIZAP is available). Reading some blog posts, I see that the suggestion is to find the .NET Framework, J# redist, etc. etc. for .NET 2 using msiinv.exe, and then msiexec /x or msizap TWA them.

Well, as far as I can tell, it just looks at HKEY_CLASSES_ROOT\Installer\Products. Maybe I'm wrong. But that worked for me. Regedit, goto HKCR\Installer\Products, and then search for anything related to the 2.0 Framework and friend. Find the product code, then run MSIZAP TWA {XXXXXXXXX-XXXX-XXXX-XXXX-...}. The format is important! If you just copy from the registry, and don't do 8-4-4-4-rest, it won't work.

After I've cleaned everything, I think installing the .NET Framework 2.0 and the J# redist (arrrg) separately from the VS install helps.

Just my few bits on getting VS working. A lot of others have posted too, so doing this plus what everyone else suggests might work :).

Misc. Technology
Saturday, February 26, 2005 2:46:16 AM UTC  #    Comments [2]  |  Trackback

 Friday, February 25, 2005
Help me reduce this program

This is probably gonna be a post where I end up looking like an idiot, but here goes...

I was playing around and wrote a small program to dump the video font table. I started at around 33 bytes, but want to get it as small as possible (to um, learn! :)). Here's what I have so far:

[BITS 16]
[ORG 100h]
[SECTION .text] 
start:
mov al,64   ; Init (but don't clear) video     
INT 10h      ; Need to call int10h to start NT's DOS video emulation I think... 
mov ax,VideoBuffer 
mov es,ax    ; Put video buffer segment into ES
mov ah,007h    ; White text (Attribute 7). AL is already zero from loading the video buffer
mov cl,255    ; All oem chars
charloop:
 stosw 
 inc ax ; Increase char, don't worry about the attribute; it's high
 loop charloop
ret
[SECTION .data] 
VideoBuffer EQU 0B800h

This assembles into:
00000000  B040              mov al,0x40
00000002  CD10              int 0x10
00000004  B800B8            mov ax,0xb800
00000007  8EC0              mov es,ax
00000009  B407              mov ah,0x7
0000000B  B1FF              mov cl,0xff
0000000D  AB                stosw
0000000E  40                inc ax
0000000F  E2FC              loop 0xd
00000011  C3                ret

For a total of 18 bytes. We can save 2 bytes by killing the mov ah,7h, but that's the video attribute, and the value that's in AH is B8, which is light grey on cyan. This looks ugly. We can also remove the first mov al and int10 call, but that means something else has to initialize the video, and that's cheating. (With those two optimizations, we're down to 12 bytes though.)
Anyone experienced want to teach me a lesson? Please? :)
Code
Friday, February 25, 2005 6:05:13 AM UTC  #    Comments [0]  |  Trackback

 Tuesday, February 22, 2005
Inline IL!

Mike Stall just released a cool tool for doing inline IL in C# (oh, and in VB). It's not full integration with the compiler (so it's not a _msil() block or anything), but it's still very cool.

Code | IL
Tuesday, February 22, 2005 2:45:39 PM UTC  #    Comments [0]  |  Trackback

 Monday, February 21, 2005
More visual spam

Wow, here's a cool technique in spam:

.,        ,; .r,                                                  iZ        .              ,  ...7  
@qy      jpp uol                                               peigllf.   @oiatmB          gnjqwgj  
 kd      fq,                                                  au0 pr rk  hac   cna        ia        
 Bym    bpB  WaW  ihjpopc:   igwpkWtk  Wfguvp  @gkbjgS         cu jS     ,,     va        lxpvkk8   
  rj    nv   uyw  yl    uq. Wig.  bly  uxn    yr;   @nS         plkea         @cx        abpX:,qof  
  gpu  ccn   WsW    8xurgl: hv     sv  WsZ      Zegydg@           b@ipl    .qwf2                8uj 
   jh .wx    WkW  xvW:: qr, db     ta  WiW    xbf,i 0sW       Za  dS nhr  jfe            8X     Zlm 
   SjdxgS    WoW ja     cb  vsZ   rds  WoW   gsB    0hZ       hx  pS gui ZdX             wks    pe: 
    xnff     alo  rfbfdvcyc  iprWkoaf  scc    yknxrxpuk0       fjWhbjsb Xkavsnhgib7 cfg   yrfmkks:  
              ,    ,:;i   :        tt   ,       ,;i   .:          jf     .       i   i,             
                            Zkl   aur                             Z,                                
                              hysqd.                                                                
                                                                                                    
                                                                                                    
     88ZS     yj             80  :mc                               7wu7       ;Z8             X2a   
  avhtmnsvp   gf             th7 Spe                             8xdqjpsW   8ehbnum         npketqb 
 jha      elj                qa,                                ,ta hb lni Spa   ilk       8dm    qk
 ig       .@8 yt   vqlwjm@   qk, rox  rotjoud                    poXdc            lj       xp2    wp
rn0           tc  ;hZ   ,vb  pu, iod ,ig   vy:                    0wkfW:        Xxh        :ud   Bjl
7a8           am    Xfxfxkx  as, ,ro  xn                            nrZio     ghl0          .dsfrhdq
 pb       Std uo  Bdm:  .rs  og, ,ih   iwvhvi2                  aS  es Smw  Wam;                  fm
 Zks;    adt; uv  ci    ;oe  en, ,do Xs0    py                  sqt jc 0vb  aW              dv.  Bic
   fcrxbimw   pi  Wfcdcuhhxs iuS Swk  caakngm2                   kpjxxqoi  ckraxuonbb Xeb   ,vsjytw 
                           .                                        wn                              
                                                                    ;;                              
                                                                                                    
                                                                                                    
                                                                     ,                              
;tX      Wx                                                         @cs        .s         .pkivk@BZ2
 ch.    ute                                                       ngBcByo      hh         ,bfxvs8ouw
  shb  skX                                                       uh, j  ud   hvwd                kc 
   aoSphZ    aomxljc;  Bglkfocf    tshoub@  euX   tqa             oq7c         er               hg  
    sfe      lx    ev  2ad   Wbw  Zm:   rya  giB yc@               Wmit0       dc              xbW  
   BfWgh      ,lqfbla  Smf    lw    @stcjia   nxrdZ                  j7crW     mj             iaj   
  Wdg rbw   .uhr   yg  Ses    jw  cel   isy   Xumw               BW  n  rw;    oj             rcr   
 mqm   ijm  or     wk  Xqi    js ayq    8mh  qdg mfi             ah  c  mx.    fi            ;it    
dlc     ,sk0 hlrhstdhx Bev   ,xj  oclkeofgfkghe   clg            ,lkmoiqmS     ev     ofn    Spn    
                                                                     ui                             
                                                                     r                              
                                                                                                    
                                                                                                    
                                                                     r                              
Bj        ju.           ty: 7rf                                    ,kuyi       ,v            ,vxi   
8vd      qnr            by; ;xd                                   mvalZmj,    ,ke          7oodlsia 
 wi.    .lc             ct,                                      ys, p  qu   jjbc          be    tyr
 Shd    bgS   uokebif   kx, Skk  rkS   ixk  yxvionB,cclf8         elXc         dm          od    Xv2
  ps    bj   Sx,   rbj  is, :bm  ep:   @u@  ut;  dsj   rs,         @rgsW       pa          yqg   eyS
  Bgs  xxB     gcetvtu  ep, ,wu  pr,   WcW  hd   rxc   vj:           uijld     kh           8wjjrebS
   tf ;bd    xlr   ,eg  wx, ,va  ye    0vW  sy   Sxw   ax,       wj  r  jm7    bj                :nZ
   .fagr.   ,kj    Wjq  eb, ,vv  ula   bdW  ly   Som   dc,       ll  y  nu     qf          pcs   gh 
    tfui     Zsfnwckteb we2 2hc  ,vxvwakms  bp   pji   nj2        eqbhqqar     eo     mpo   pgnqbj  
                                                                     h                              

Yea, super-small font used for ASCII art. Start throwing some tables and CSS... and we'll have stuff that won't be that easily analyzed, at least by current keyword based approaches.
(I cleaned up the HTML. They had mismatched tags... why is it that people are smart enough to write inventive things like this (or viruses) and then screw up on simple syntax (HTML AND English)?)
Misc. Technology
Monday, February 21, 2005 4:25:02 PM UTC  #    Comments [1]  |  Trackback

 Thursday, February 17, 2005
Kids beware: 1337 speak for parents

On an MVP mailing list today, someone posted this link:

A parent's primer to computer slang
Understand how your kids communicate online to help protect them http://www.microsoft.com/athome/security/children/kidtalk.mspx

To which I replied:
... I just felt a disturbance in the force, as if millions of kiddies yelled out in embarrassment as their parents tried to talk leet to them...

M0M [133t!]: d00d, did j00 |-|4/\3 phun 4t sk00l t0d4yz? $c13nc3 is teh

r0x0rs, w00t! D4D 4nd I R g0ing 0ut ToNiGHT, g0nn4 sh0z /\/\y m4d

sk1llz. Th3r3's ph00d in da phridg3.

Son: I'm so embarrassed. Never talk that way again, please.

 I'm surprised they didn't have some sample conversations to test your knowledge. They also left out "r00t".

Steve adds: And M$

Hmm, I wonder, maybe MS will start doing a whole series on slang? Maybe they're working on a paper like that right now? “What does it mean when your son says 'Her? The whole shool's had root access.'”

Humour
Thursday, February 17, 2005 6:28:14 PM UTC  #    Comments [1]  |  Trackback

 Monday, February 14, 2005
Developer Evangelism?


While visiting my parents' clinic in Guatemala two years ago, I decided to do a bit of developer evangelism. Perhaps I should go back to tell her WinFS was cut?

Humour
Monday, February 14, 2005 6:55:58 PM UTC  #    Comments [5]  |  Trackback

 Saturday, February 12, 2005
Saved! ASP.NET team decides not to screw us up!

Doing some work on a new site using Whidbey, and I came across this:
http://msdn.microsoft.com/asp.net/whidbey/beta2update.aspx#ASP.NET_2.0_Compilation_Model_Changes

YES!!! Whoever says MS doesn't listen is definately wrong. Quick recap: ASP.NET changed it's project system/compilation model to better suit people who think HTML is a programming language. Good ASP.NET developers pushed back... hard. The “Web Platform and Tools“ team nicely listened. Yey!

The blessed article is a bit terse, so I've provided common-language translations (sarcasm and jest ahead... it's just because I'm so relieved, no offense intended):

“In response to significant customer feedback...”.
Translation: “We spoke with professional developers, instead of just going after the “PHP is teh r0x0rs” group, and the “I know HTML and thus am a 'Web Developer'” group.“

”The goal is to improve the code-behind and code-separation experience and enable the partial class paradigm to be used to improve the code-behind experience while continuing to maintain a syntax and functionality that is very similar to ASP.NET 1.x.“
Translation: “We fixed the compilation model.” 
Note: Wow, that's a really long sentence. And they even used the word “paradigm“. Wow.

“As a result, it makes upgrading of v1.x projects even easier and further reduces new ASP.NET 2.0 specific concepts.“
Translation: “Customers told us backwards compatability and migration was actually important.“
Minor correction: “upgrading of v1.x projects *possible* and further...“ (Yea, I had zero luck upgrading projects. Yet I could open VC++ 6 projects with VS2005 and compile and deploy to client systems with zero problems.)

“In short, this change enables developers to continue to pre-compile ASP.NET pages for significant performance gains while still being able to maintain the .aspx markup content separate from the binary.“
Translation: “Now things work like 1.1 again.“

Wow, this is really, really great news. I'm thrilled. Can't wait to get Beta 2, even if it means having to redo a nice amount of code.

Oh, BTW, they shortened the special directory (the Vile Code directory) prefix from “/Application_“ to “/app_“, and rightly canned “/Application_Assemblies“ (which was the “/bin“ replacement). Why “/Application_Assemblies“ was ever a good idea apart from consistency is beyond me...

Even so... something gives me the feeling that the compatability part of their team is somehow very much different from say, the Windows Shell team :).

Code | Humour
Saturday, February 12, 2005 9:21:52 AM UTC  #    Comments [0]  |  Trackback