Tuesday, May 17, 2011

Essbase API - Ephemeral Port Issues/Resources

One of the most popular posts on my blog has been the post where I showed how to open up the number of ports available to Essbase. This is necessary as the Essbase API is quite chatty and, when combined with the small number of available dynamic ports and the long default timeout on these ports in Windows, running out of ports has become an issue.  Most users see this when running many, many repetitive API calls against Essbase. 

One example is when users run the Essbase Outline Extractor against a large database.   Back in the old days when the Essbase API was designed, it probably wasn’t much of a consideration.  These days, however, with million member outlines and really fast computers, it is very easy to run out of ports.

We are currently testing some new Dodeca functionality we plan to introduce this summer that optionally performs some intensive caching of the Essbase outline.  Of course, we ran into the port issue very quickly and, in the course of looking at how the ports have changed in the new versions of Windows, found a couple of interesting links to pass along.

First, I found a nice link that explains how dynamic ports work.  Better yet, this link covers dynamic ports on non-Windows operating systems.  You can see this link at http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html.   This link also talks about the new, larger default dynamic port range in Windows Vista, Windows 7 and Windows Server 2008 which now feature a default range of 16,384 ports.

I also found a link to a Microsoft KnowledgeBase article that talks about the new defaults and shows ways to both display, and dynamically increase, the range of ports.  The KnowledgeBase article is located at http://support.microsoft.com/kb/929851/.   I ran the commands listed there on my Windows 7 laptop:

C:\Users\timt>netsh int ipv4 show dynamicport tcp
Protocol tcp Dynamic Port Range
Start Port      : 49152
Number of Ports : 16384

I then increased the number of ports dynamically:

C:\Users\timt>netsh int ipv4 set dynamic tcp start=5000 num=60536

C:\Users\timt>netsh int ipv4 show dynamicport tcp
Protocol tcp Dynamic Port Range
Start Port      : 5000
Number of Ports : 60536

The changes appear to permanent.  I rebooted my machine and found the new configuration remained.


PiltdownMan said...

Thanks Tim, for this blog post, and for making me aware of the netsh utility. It helped me get my outline code to be able to read an outline that I had not had any luck with previously.

You mentioned in your notes that your latest code performs some caching of the Essbase outline. Can you give any more information on that?

I've been looking for any API methods that would allow one to grab member information in bulk, or at least minimize the back-and-forth communication that an outline read would require.


Tim Tow said...

If you need only the most common properties of a member, you could use the esbQueryDatabaseMembers or IEssCube.queryMembers API to get what you need. As a bonus, it is much faster than the Outline API.

I plan to blog on the new outline caching functionality in Dodeca in the coming weeks.


PiltdownMan said...

I appreciate the advice, and am looking forward to your upcoming Dodeca discussions.

I might yet find what I need with the new MaxL "export outline" command, combined with a little bit of XML parsing.

I consider that a workaround, but if it works, it's worth mentioning.