yoni.mizrachi

10 Posts

There are many pitfalls to beware of when upgrading your NetWeaver landscape (by installing a new SP or EHP). The preparations and logistics themselves can be exhausting, not to mention the pounding heart when you restart the server for the first time. Let's assume everything went smooth, all those weeks of preparations paid off and you can sit back and relax (hey, did you ever have doubt?).
A few minutes later, the phone rings - an end user is on the line saying that something in the portal is not working. You find out that there is a javascript error. You ask the user to clear his browser cache and try again - BINGO! Success. Back to the chair. The phone rings again, same issue different user. Now you realize the magnitude of the problem - it is possible that some small js file was changed and the incompatibility with the old version in the browser cache is killing your success story. Is it possible to automatically clear the cache for all users in the company? But what about all those with laptops that connects from home? And the manager that is now in an important meeting abroad?
Well, you get the picture.

 

What could you do to avoid this?
Prior to the upgrade you could change the cache configuration in the server from 1 week (the most common configuration) to 1 day, and later reduce it to 2 hours. This will make sure that the old resources would be kept in the browser cache for a minimal time so you will likely to avoid this problem. This introduces additional tasks and worries - did you remember to make the change in the configuration? Did you remember to set it back to the original value after the upgrade? Is there a performance impact on your server? Did end users feel this?
Not the best solution, but unfortunately you didn't have better option.

 

Introducing the "resource versioning" solution
A new feature in the portal allows you to gain better control of your static resources.
As you know the html pages in the portal are mostly dynamic, when they are built on the server side there is an API for embedding the javascript, css, images and other resources within them - it is usually done by using PRT's IPortalComponentRequest getResource(...) method (the recommended way). Raising a flag in the portal configuration will make the PRT add a unique string to the end of each resource URL, this string is unique to the application that contains the resource and being regenerated on each deployment of that application.

The result will be a URL that looks similar to this:

http://... Irj/portal/... /someScript.js? 1c506cf475c726e63cf9a72279a06f3f

Your code will look similar to this:

IResource myResource = request.getResource(IResource.SCRIPT, "scripts/ someScript.js ");
response.include(request, myResource);

The browser will store this script in the cache under the full URL, including the unique string after the ‘?'.
Each time you deploy an application the unique value will be regenerated, so if this application contains static resources and they will be requested again by the PRT API the link will be created with the new identifier and the cached version will not be used.
Since you usually don't make frequent changes in production there is no risk to performance (because of invalidated cached content). However, if you have an emergency fix, or an upgrade, you can safely assure that end users will get a fresh copy when they connect to the portal.

Not all resources in the portal are using this versioning feature, but the good news are that those who don't usually have similar mechanism. In order to benefit from this new feature in your custom apps make sure you use this API for adding your resources to the response. Now you get this control for your custom applications for free, could it be any better?

 

Are there any special considerations?
One side effect is that the browser may hold redundant resources in cache, i.e. two scripts with same name but different identifiers. The browser cache has a policy for managing its storage and should quickly overcome this, when the cache threshold is reached the old resources will be deleted. No worries here.
Is it expensive to generate this identifier? The identifier is generated in the deploy process anyway so there is no additional overhead for generating it - just remember that each time you deploy an application the identifier is regenerated, even if you deploy the same application with absolutely no changes.
One more thing, if at runtime you ask for the resource without the identifier (ask for http://.../someScript.js) you will get the current version and it will be kept in cache under this name. Same with any random string you put there (ask for someScript.js?abcd) , there is no mechanism on the server side that validates this string to match the application identifier - it is just for controlling the version on the browser cache. So, if you run load test or have automated scripts that call resources you don't have to use complex correlation rules to match the identifier - just be sure to clear the cache first.

A thought - if all applications in the portal used this method then theoretically you could cache resources forever, knowing that when a resource is changed you have full control to replace it immediately for all users. Unfortunately this is usually not the case - the cache expiration configuration in NW is applied on all resources served by the server weather they have version id or not, and some do not have it so they might get "stuck" in the cache without a way to control them.

 

How does it look like?

Before activating the versioning feature:

URLs before activation

 

After activating the versioning feature:

URLs after activation

 

How do I activate it?
Login to the portal as System Administrator, navigate to System Administration -> System Configuration, and on the detailed navigation choose Service Configuration. Browse the Portal Runtime tree -> right click Central Configuration, choose "Configure". Look for "js.SupportVersion" (I know, not the best name) - change the value to "true" if you want to activate the feature, "false" will deactivate it. Perform a restart and you are set.

 

Configuration screen

 

It is easily reversible and doesn't make permanent changes (besides the resources on the browser cache), so don't be afraid to evaluate and play with it.
Suggestions, feedback, thoughts and constructive criticism are always welcomed :-).

 

Availability?
The feature is available in the following versions:

  • NW 7.0 EHP2 SP0 - the default value is "false" 
  • NW 7.0 EHP2 SP2 - the default value is "true"

 

And an important update
my colleague Irit Okshtein collected and compiled a "Performance Best Practice Guide for NW04s", it includes important practical and conceptual information that can really help you out. If you have NetWeaver landscape you should read it!
The guide can be found in the following link:

Best Practices - Portal

 

You probably already heard of the new exciting features provided in the Portal for SAP Enhancement Package 1 for SAP NetWeaver 7.0, if not - I recommend you read this blog post  (What's New in the Portal for SAP Enhancement Package 1 for SAP NetWeaver 7.0).

 

 

 One cool new feature is the Navigation Cache Preloader, it allows you to automatically load certain predefined user roles without waiting for the user to actually login into the portal and initiate the load of the roles himself.

What is it good for? If your user has many roles, his initial login will be rather long since the roles are not cached yet and need to be fetched from the database. In addition, multiple users logging into the system right after restart while the system is "cold" may put some extra stress on your system, causing "peaks" in CPU and high response time. Using the preloader makes it possible to automatically load roles on server startup, making them available on cache when the user asks for them (think of "push" vs. "pull"). Since the preloading is usually done when the users are not using the system, it "smoothes" the load on the system and eliminates possible peaks.

A common scenario would be, for example, if your boss has something like 50 roles and it takes him ~2 minutes to login - preloading his roles may reduce the login time to only 2-3 seconds. Not kidding, actual real-life case! So if you want to become an IT super-hero and really save the day (or at least a considerable time of it) and you think yourself as brave enough - keep on reading! It may be worthwhile for you.

 

 

How does it work?<br />One important prerequisite is that the navigation cache will be activated; otherwise there will be no point in preloading the roles. Some readings about navigation cache activation and configuration can be found here  (http://help.sap.com/saphelp_nw70ehp1/helpdata/en/8c/47de6155c445c08c9f453100deceab/frameset.htm).

By using the Preloader the portal fetches the user roles and stores them into the navigation cache. The roles in the cache are being reused and are not user-specific, so every user that tries to access the same role will benefit from it being already in cache.

Other possible configurations - you can specify how deep this fetch should be - for example, fetch 3 levels deep into the navigation hierarchy (will include also the detailed navigation structure).  You can even define which Locales to preload, so you can preload the roles with the German and English translations for your users' convenience (or any Locale that is relevant).

 

 

 

 

Who is it for?<br />I don't recommend activating it automatically, you better think if this can actually help. There is no need to preload roles to cache if they are rarely being used - it just takes up heap space. I think that if you have a problem that requires the Preloader, by now it will be obvious to you.

 

 

 

 

Activation and configuration<br />Login to the portal as Administrator, navigate to "System Administration" -> "System Configuration" -> "Service Configuration", on the list of services look for "com.sap.portal.navigation.cachepreloader". Navigate into the tree and click the "CachePreloaderService" to open the configuration screen.

 

 

 

Preloader configuration screen

 

Now you have two text fields:

Run on startup - true means that the preloader will automatically run with the configuration after the server is started. False means it will not be activated.

Users to preload - here it get a little tricky. From the name you already understand that you can define more than one user, the format is as follows:

 

[<user name>:<navigation levels depth to preload>:<leave this as false, reserved for future use>:< comma separated list of Locales>]<br />you can add additional user configurations by using semicolon, for example

;[myUser2:4:false:en,de]... and so on

 

 

So which users should you use? You can specify existing users, or create a new user for the preloading and assign it with all the roles you want to preload.

 

 

How many roles to preload? How deep?<br />This is the big question, and sadly there is no easy answer. Basically it will require trial and error until you get the best configuration for your need. What I can provide is some insights that will help you with this process.

First and most important, as I mentioned earlier the Navigation Cache should be activated and running  (http://help.sap.com/saphelp_nw70ehp1/helpdata/en/8c/47de6155c445c08c9f453100deceab/frameset.htm)*. The navigation cache has a configurable capacity of how many objects it should store and for how long. So, for how long? If you have a production system and the content is not changed during the week, you can safely define the navigation cache expiration to 1 week. Anyway, you can always manually flush the cache when needed. <br />How many objects? The default configuration is set for 5000 entry-point objects and 5000 navigation nodes, it should be enough for most cases. What you should do is to check how many objects are there in the cache (both parts) after preloading - if you are way below the limit it is OK (users will probably use a few additional roles for their normal portal activity), if you are close to the limit then you should either set it to higher number or play with the number of roles and level depth that you are preloading.</p><p> </p><p>Testing for success

*As always testing is key for success, and here there are additional things you should know. Be careful, it is going to be a bit techi.

There comes a day in someone's life when he has to use a network sniffer to make sure all those bits and bytes on your super-server are sailing in the right direction. Cases like general network slowdown, strange HTTPS behavior and other "funny" phenomena's may indicate that your Net is not up to the work anymore.

When you use such a sniffer, a whole new world is appearing - no, it's not the matrix, but close enough. A sniffer like WireShark can show you what happens under the hood and enable you to identify DNS resolving issues, proxies, SSL handshake problems and other network errors, as well as network related configuration problems. One of the problems that usually come in mind is involved with the TCP/IP packet checksum check,  if you have a bad line it may be that some of the data is being corrupted and thus leading to bad checksum value - the packet needs to be retransmitted and you suffer from the delay.

 

What is Checksum for TCP/IP?
in short - when you send TCP/IP packets you need to make sure the data was not altered by mistake due to network errors, the method used is CRC (Cyclic Redundancy Check). CRC takes the message stream as input and produces as output a calculated short representation of the message. The value is added to the TCP/IP message and later on someone on the receiving end can run the same method on the message and compare the two - if they are the same, most chances are that the message was not altered. Not the same? This packet is corrupted and will have to be sent again.
For TCP/IP packets a Checksum algorithm is used, which is rather simple and effective. The checksum is calculated and added to the IP and TCP headers.

 

What does it have to do with performance?
Checksum calculations take CPU cycles. Since the server CPU is also in charge of handling the TCP/IP stack and creating the messages it is "wasting" resources on these actions, when instead your could squeeze more "juice" for your application.
Here come the network adapters to the rescue - network adapters manufacturers embedded functionality in the network adapter itself so it can perform several actions in the hardware instead of consuming server CPU for that, all you have to do is to tell the server that you "offload" some of its responsibilities to the adapter.

 

What can you offload?
There are multiple operations but I think the most important ones are:

  • TCP checksum offload - the process of calculating the packets checksum is delegated to the adapter.
  • Segmentation offload (LSO - large send offload) - large packets are divided into smaller frames for better efficiency. This option means that the adapter will handle the segmentation instead of the server.

There are few more options but you will have to explore it yourself, you won't believe how many articles and studies you can find on these two alone...

In Win OS you can find it in your Network Connection -> Properties -> Configure -> Advanced

 

as shown below...

network adapter configuration

 

 

Is it really good?
The million dollar question! There is some debate about this, it depends on your network, hardware and application usage profiles but you should be aware of it because in some adapters this is enabled by default and for others not. For example, see note #1023047 for AIX settings recommendation.
In theory if you have a fast CPU which is not running at full capacity it may be faster to use the CPU to calculate the checksum, using the adapter may give you less data throuput. But this is a big discussion and the manufacturers/providers have different recommendations according to your hardware (for instance - IBM and HP...).
My recommendation is to experience with it first and test the impact on your landscape, the numbers I found shows about 0%-15% changes in CPU, but again - it depends on so many parameters that it is not possible to extrapolate.

 

Why is it so important to know that?
Closing the circle that we started with, when you use a network sniffer on a system that enables TCP checksum offloading you may be mistaken to think you have a network problem. The sniffer is "sniffing" the network packets before they arrive to the network adapter, so the checksum value in this stage will be incorrect (we didn't try to calculate it yet). So you have a scary error message in the logs "TCP checksum incorrect" or something similar (depending on your software). So don't panic, and before you dig your wiring from the ground check your adapter settings first.

 

That's it for today, came out longer than I thought. Hope I didn't get you to sleep during working hours. For me, it made me feel much more respect for the people who work nights and days to make it possible for us all to connect.

   If you are running automated tests for the portal you may have noticed the parameters we pass inside the URLs. It is good to know that we don't add them just to make the URLs as cryptic as possible (we reserve the right to do so in future versions :)) but we have a good use for it. One such case is the windowID parameter.  This is how the parameter looks like in its natural habitat - the inner page URL:  .../2fcom.sap.portal.innerpage?*windowId=WID1209300705273*...   windowID parameter in portal innerPage URL
Yoni Mizrachi

HTTP dirty talks #2

Posted by Yoni Mizrachi Feb 13, 2008

<body><p> </p><p>Reminder - If you are reading this post before reading my previous ones I kindly ask you to go back and read the first ones first... I'm trying to lead you through a process. Thanks :)) </p><p>So by now everything looks a little brighter - the browser is set, you have a browser tracing tool and you have seen how things looks like from your end. Hopefully (or not...) you spotted some problems and fixed them already. Never thought there is so much action behind the scenes? We are just getting started. </p><p>Today we will dive deeper into the http traces and learn some more about the client-server dialog, as well as some tuning tips on the server side that might save you some time.</p>h3. Into the deep water

<p>The http spec defines many different header names that can be used, most of them were defined in http spec version 1.0 but some are only introduced in http 1.1 spec. To add to the confusion, some of the headers are explicit (meaning you specifically define what behavior you want) and some of them have implicit meaning (you get some behavior as result of other header you defined). Add to the equation the browser version factor and you get a nice cocktail that will certainly give you a headache. You think you are bigger than that? You will be knocked down when proxy servers joins the party. Don't tempt me. </p><p>Unfortunately (and luckily for you) I won't be able to cover all headers or different combinations, the spec is unbelievably long and far from being easy to read or understand. I will refer to the common scenarios and naïve interpretation of the spec, I know there are always exceptions and special cases - want to share one? this is why we have the "comments" section at the bottom. <br />Let's take an example and analyze it.</p><p>You know by now how to take HTTP traces, I will continue to use HTTPWatch for the demonstration - to see the headers of the request and response you should click the URL and navigate to the "Headers" tab. See image below.</p><p> </p><p><img  />//weblogs.sdn.sap.com/weblogs/images/59389/httpwatch_headers_tab.JPG|height=384|alt=httpwatch headers tab|width=598|src=https://weblogs.sdn.sap.com/weblogs/images/59389/httpwatch_headers_tab.JPG|border=1!</p><p> </p><p>Usually the headers are separated by line breaks and looks like <header name>: <header value> but in this tab they are displayed more conveniently (for raw data go to "Stream" tab).<br />The spec defines which values are possible for every header name.</p><p> So let's review the more important headers.</p><p>Consider the below headers, this is the Login post:

 

POST /irj/servlet/prt/portal/prteventname/Navigate/../.. HTTP/1.1

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, /

Referer: http://localhost:53000/irj/portal?...

Accept-Language: en-us

Content-Type: application/x-www-form-urlencoded

UA-CPU: x86

Accept-Encoding: gzip, deflate

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)

Host: localhost:53000

Content-Length: 298

Connection: Keep-Alive

Cache-Control: no-cache

Cookie: PortalAlias=portal; saplb_*=(ilperf125_F37_30)303540750; ...

 

 

POST /irj/servlet/prt/portal/prteventname/Navigate/../.. HTTP/1.1<br />First line says POST or GET, which is the http method we use, following by the requested URL and then HTTP/Referer: http://localhost:53000/irj/portal  (http://localhost:53000/irj/portal)?...<br />Who triggered this request; this is useful in case you want to trace which file caused this request to be sent.

 

 

 

Accept-Encoding: gzip, deflate<br />the browser explicitly specifies that it support gzip data compression, so the server can compress the response body. Just to clear things out - a) it is up to the server to decide if it wants to compress or not, b) the http headers themselves can't be compressed; you need the headers to tell the browser that the body is actually compressed.

 

 

 

Cache-Control: no-cache<br />in this case the browser requests that the request-response will not be cached. This is normal for POST since it involves with submitting parameters that needs to be processed on the server.

 

 

 

Connection: Keep-Alive<br />this means that the browser will reuse the connection after it receives the response, unless the response specifies otherwise (like Connection: close).

 

 

 

+Cookie: PortalAlias=portal; saplb_=(ilperf125_F37_30)303540750; ...

+On every request the browser sends the complete list of cookies that are relevant to that domain. Remember I said that the headers can't be compressed? This is a major downside for cookies since they can be very long (and could have been easily compressed since they are textual).</p><p>And now let's go the server response (headers received by the browser):*

 

HTTP/1.1 200 OK

Server: SAP J2EE Engine/7.00

Content-Type: text/html; charset=UTF-8

Content-Language: en-US

Content-Encoding: gzip

Date: Mon, 21 Jan 2008 15:29:24 GMT

Transfer-Encoding: chunked

 

 

 

 

HTTP/1.1 200 OK<br />The server responds* with the response code (talked about it last time) and the http version it supports.</p><p>Content-Type: text/html; charset=UTF-8<br />the content type of the returned body, In our case this is html file. </p><p>Content-Encoding: gzip<br />the content is compressed. In httpwatch under the "stream" tab you can see the raw request and response. If you look below the headers you will see gibberish - this is the actual compressed content (binary data). Go to the "content" tab and you will see the body after it was decompressed.</p><p>Date: Mon, 21 Jan 2008 15:29:24 GMT

The date and time this message was originated.</p><p>Transfer-Encoding: chunked<br />the server does not provide total response length.

 

</p><p>Let's see another example - this is a response of resources that should be cached:*

 

HTTP/1.1 200 OK

Server: SAP J2EE Engine/7.00

Content-Type: application/x-javascript

Last-Modified: Tue, 01 Jan 2008 09:40:19 GMT

Cache-Control: max-age=86400

Content-Length: 69729

Date: Wed, 23 Jan 2008 15:44:59 GMT

 

 

What is the difference here?<br />You can see the content type header that indicates this is a javascript file, and the cache control returns with a "max-age=86400" value. This means that the server tells the browser it should cache it for 86,400 seconds, which are 24 hours. From now on, for the next 24 hours the browser can load this file from cache whenever it is requested with no need to request it from the server again.

What happens when the 24 hours are over?

The server sent an additional header "Last-Modified", this is the date when the requested resource was last modified on the server. The browser saves this date together with the cache definitions of the file and when the cache period times-out it sends a conditional request to the server asking if the resource was modified or not. If the resource was modified the server will send the updated resource file and replace the cached version, if not - the browser will send a short response that indicates the browser to continue using the cached file (and continue to cache it for the next 24 hours).

 

What can you do to improve performance?

 

The http server allows you to configure many parameters, you should check what is configured and make sure to have the best matching configuration for your needs.

How?

 

Use the VisualAdmin tool. Go to Server_abc -> services -> HTTP Provider service

On the Runtime tab you see the following 4 options, make sure they are properly configured.

 

 

 

 

*

Yoni Mizrachi

HTTP dirty talks #1

Posted by Yoni Mizrachi Jan 7, 2008

Hi,

Sidebar:
Just not long ago I mentioned the importance of keeping your Get your free I(E)Tunes, well now you can see it pays off. MS published a new patch for IE6 which solves slow web browser performance when browsing pages with JavaScript code. Tests show varied improvement from 0% and up to 50% depending on the exact scenario. I recommend installing it... enjoy.

 

Now let's go back to why we are here in the first place - client side tracing. By now your IE should be Get your free I(E)Tunes, patched with the latest fix and you installed a Tools of the trade - improve portal performane using browser tracing tools. I will use HTTPWatch today, but any tool should show you similar results.

Why is it so important?
Sometimes during this simple process you discover many errors and problems that needs to be attended, you won't find them otherwise. This tracing is important if your users are within the LAN, if they are browsing via WAN - I think skipping it is not even an option.
The main two goals you want to achieve are:
* reducing the number of network roundtrips (utilize the browser cache)
* reducing network traffic (get the request/response as thin as possible)

This is your recipe for true happiness (oh, just after world peace and good health of course).

 

How do we start?

Choose a simple scenario:
Your scenario should preferably involve one click/navigation step, it's easier to isolate the problems this way.

Clear the cache, and warm up the browser:
You want to record the http traces when the browser cache is full, this is usually your common scenario. BUT, before you start measuring you better clear the cache once and perform your scenario to warm-up the browser and populate the cache, this will remove old resources you don't need any more.
*Tip - in IE6 If you browse to some page, clear the cache and at the end click the "OK" button the browser will immediately reload the page to cache. If you click "Cancel" it will not load it...  just good to know.

Record your trace:
Go to the page you want to start from (for example the login page), click the record button in the tracing tool, perform your navigation in the browser, when the page is fully loaded stop recording. That's it! Save the trace so you can also reference it later and you can start your analysis.

Analyze:
I suggest doing it in a few steps and not everything at once. First clear out the obvious problems (usually errors) then get a better understanding of what is being called and repeat the tracing.

 

Choose your enemy - response codes
The first thing you look for is the response codes of the server responses, this will give you a quick view of your status. You can find it either in the "Result" column or in the first line of the server response headers.

 

response codes in HTTPWatch

 

The common values are:

Cached - this resource is cached on your browser, the request is not sent to the server and you will not see this request in the http logs. The browser fetches this resource locally from its internal cache.

200 (OK) - if your resource is not cached this is what you prefer to have. 200 means OK, the server behaves normally by sending back the resource you requested.

302 (Found) - this actually means a redirect. What happens is that you request some URL and the server send you back a new URL, now the browser sends a new request to the newly received URL. This is bad, very bad. You pay double the price here, Instead of one roundtrip you get 2. The common situations for this is during login (redirect to some authentication service), redirecting to external content such as dotNet or if you have a "nice looking" URL for your portal and it redirects to the actual "ugly" URL. If you can avoid this situation it is preferred... otherwise, everything has its price.

Below you can see an example for 302 response (highlighted with the mouse) and the corresponding "Location" header. Note that the response body is empty ("Content-Length: 0" header), no actual content is returned except for the URL in the header.

 

302 response example

 

304 (Not Modified) - This is one vicious performance killer and worth a few more words, it is usually related to cache configuration problems. Your browser is smart, it prefers to use its cache over sending new requests to the server BUT what happens when it is not sure the cache is still valid? It sends a "conditional request", this is a small request for the resource with the last time it was changed, if the server decides your copy is still valid it returns an empty response with 304 code and the browser will fetch the resource from its cache. It also happens right after the cache lifetime period is over or when it is absent. We will get more into it next time when we discuss http headers.

401 (Unauthorized) - or in other words your authentication failed/missing. This is something you definitely don't want to see.  You can now check the URL that returned it and check what is wrong here.

 403 (Forbidden) - stop in the name of the law! surprise, surprise, you are trying to view content that you are not authorized to see. naughty you!  Similar to the above 401 response (same-same but different), check the URL and either extend the permissions or remove this resource from the page.

404 (Not Found) - the resource is not located where you expect it to be and the server can't find it. Sometimes it is a missing image that wasn't deployed, sometimes it is a typo in the html - in any case this is a problem that is easy to fix, find the missing resource and put it in the right location.

500 (Internal Server Error) - You have a problem, or better said - your server has a problem. Something is very wrong with this request on the server side. Probably you can find some errors in the log files...  

503 (Service Unavailable) - The service is not available. In many cases it means that the service you requested is still initializing and not fully started yet.

If you are curious about other response codes you can find the complete list of HTTP response codes in rfc 2616.

 

A simple example from the SDN site

by now you probably say "oh well, how bad can it be? Does it really worth the effort?", they say a picture worth a thousand words, so watch what I marked in red below:

 

304 response example

 

What do you see?
This is a trace I took while browsing the SDN from my desktop in IL.
The first marked file from the top is of type image.gif, it is a simple gif file that the browser loads from cache (you can see the "(Cached)" value in the results column). Time estimation for retrieving it is 0.002 sec. sounds reasonable, isn't it?
Now watch the marked file below to see what happens when the cache is not sure if it has an updated version of a file - it sends an "if-modified-since" conditional request, the server receives the request and verifies the time stamp of the file and decides that the file did not change. The server now sends a 304 response code and the browser ends up retrieving the image.gif file from the cache. Total time for retrieving the file is 0.717 sec. almost a full second for a small gif file. And I want to stress this - both files were eventually loaded from the browser cache!
 You wonder what is this important gif file? If you click on my name at the beginning of this post and get to my list of posts, see this small SAP icon at the right side of my name? BINGO! Almost 1 second of your life... you should give this icon more respect now.
While you are here, why not clicking on my previous blogs or leave me a nice message? Support my effort, you know.


What's next?
You have now about 2-3 weeks to get experienced with your favorite tracing tool and check all those missing files, bad permissions etc. I will use this time to write the next post, where I will show you how to understand the http headers and use the HTTP configuration options on the server to eliminate the 304 responses, along with other tuning tips.

 

Until next time,
Yoni

So you think the server is tuned, you Get your free I(E)Tunes and the Chop your logs!, but something still doesn't flow right... what can it be? How can you trace it? Do you think the server response is optimized? Let's be sure of that!

Finding performance problems doesn't always mean you need to take your administrator permissions and dive into the bowels of the monster (a.k.a your portal server). You can get a pretty good picture of what is going on using your browser and some http tracing software. This week I want to give you a glance of some tools that can help you trace the problem from the client side. Next time I will demonstrate how to find these pesky annoying problems, identify them and off course - take care of them once and for all.

You will be amazed of the amount of information you can reveal from this easy-to-do client side tracing.

 

What tool are you looking for?

You are looking for a tool that will help you monitor the client-server chit-chats, easy to do if you work for one of the intelligence agencies... if not, you will need a gauze soaked with anesthesia, pair of scissors, lock picking equipment and some heavy tool to beat the network's administrator password out of him. OR just keep on reading :)).
The best tool will be one that is plugged into the browser and can show what is loaded from cache and what is going over the wire, second in best is a "proxy like" tool that can only show what is going via the net, it will also require additional configuration. On this point I will say that I don't have any specific preference for one of the tools, SAP has a license for one so I use it and it gives me what I need, I don't see any clear advantage in one of the other tools I mention below. If you have different experience the "comments" part below is craving for content...

 

For IE we have the following tools (partial list of tools):

HTTPWatch - http://www.httpwatch.com/

HTTP Analyzer - http://www.ieinspector.com/

Debug Bar - http://www.debugbar.com/

For FireFox

http://www.getfirebug.com/

Proxy tools (won't show you the cache requests)

http://www.fiddlertool.com/

 

How to work with it?

In each tool it is slightly different but the principal is the same, you click some "start" button, perform your scenario (for example, login to the portal) and then "stop". You can now analyze the data that was collected. What you are interested in is the request headers, amount of content, whether or not the response came from local cache or server, what was the response code etc...

Screenshot of HTTPWatch trace of the portal:

HTTPWatch screenshot

 

Marked with red you can see the http requests and some basic info about each one, below are the details (marked in blue).

Next time we will discuss real-life examples of client-server communication.

 

Until next time,

Yoni.

Yoni Mizrachi

Get your free I(E)Tunes

Posted by Yoni Mizrachi Nov 29, 2007

So, you spent months in setting up the portal and optimizing it to perfection and still something doesn't feel right? It is time to make sure your browser is also up to the job...

 

Tuning your IE should take just a few minutes and most of the times it will already have the proper settings. In case it is not, be sure to verify it with your IT department since this may be part of your company's global security policy (or something like that) and you don't want to mess with the security guys...

The following is relevant to IE6 and IE7, the general guidelines also apply to FireFox browser but this time I stick with IE. I will appreciate if you FF users can share your experience and recommendations.

What can you do?

 

Keep your IE up-to-date

Make sure you use the most up-to-date version of IE. Besides the security fixes there are also performance improvements and bug fixes that can help you. For example, memory leak fixes that are being solved can save you troubles and speed up page processing.

How: periodic visits to Microsoft updates site.

 

Avoid toolbars and Add-ons

A friend of mine once complained his browser became very slow. I came over just to see him with headphones streaming sound from his radio IE plug-in. The network bandwidth the streaming required didn't leave much for other pages to load. A short uninstall and a $20 brand new radio solved the problem. Unfortunately I couldn't solve his bad taste in music...

Toolbars/Add-ons are nice, but there is a penalty you pay... they usually slow down the page loading because they require resources or adding more processing overhead. You may not avoid them completely, but try to choose them wisely - if your browser looks like a Christmas tree with many colorful buttons know that something is wrong :))

How: Go to Tools -> Manage Add-ones and disable what you don't need.

 

Disable pop-up blocker for the portal

Some applications may use it to close web sessions.

How: dependant on your pop-up blocker software you can add the portal's domain to the white list.

 

Review your caching configuration

Every once in a while I see someone that tries to outsmart IE. Yes, there are ways to tweak your IE and speed it up - this is not one of them! Your browser allows you to choose between several caching policies, the default is "Automatically" and it probably won't be wise to change it. Your IE and the server share a common language and they are negotiating what to cache and what not, I'm sure you heard the phrase "mothers knows best" well so does your NW Administrators! The caching configuration that is set on the server gives the tone here and your browser has the easy task of following the directives, if you change the algorithm and tell him to check for updates when there is no need you end up with more server requests, which involves more roundtrips and more server processing time. If you have an urgent need to verify that you have the most recent content you can just hit CTRL + F5 and you will get a fresh copy of the page from the server.

Also make sure your cache size is ok, 1GB will not help you much and also 10MB (this is not the place to get cheap).

 

How: Go to Tools -> Internet options -> Settings button

IE cache settings

 

  • Set the caching algorithm to Automatically
  • Set the disk space for the cache to a reasonable value (100 - 250 should be ok).
    While you are doing so clear the cache and get a fresh start...

 

 

Allow HTTP 1.1 protocol

HTTP 1.1 protocol includes advanced cache headers and support of compression, both are very useful and can get you significant improvements. This is fairly safe configuration, your browser will tell the server that it supports 1.1 but it is the server who gets to decide so there is no compatibility issue.

I would, however, recommend consulting your IT before enabling HTTP 1.1 via proxy connection (if not configured so yet), just to be on the safe side.

 

How: Go to Tools -> Internet options -> Advanced tab

http 1.1 settings

 

  • Allow using http 1.1 protocol
  • Using the http 1.1 via proxy is dependent on the company's policy

 

Advanced cache settings

This is a major performance killer but I also know that some companies makes it a security policy not to allow web cache to be kept on your disk. My recommendation is to check if it is enabled, if so then you are set and if not you can consult your IT department.

In short, it enables/disables keeping cache on your hard-drive, you can disable keeping only secured content (usually SSL protocol) or don't allow any content - in that case every time you close the browser the entire cache is erased... bummer!

 

How: Go to Tools -> Internet options -> Advanced tab

IE advanced settings

 

  • Allow to store encrypted pages to disk -cache pages that were viewed via SSL (should be unchecked)
  • Don't empty the cache automatically each time the browser is closed (should be unchecked)

 

 

This list may go on and on but it includes the most frequent problems I saw so far, if you have comments, questions or you are an angry IT guy please share!

 

Until next time,

 

Yoni

Yoni Mizrachi

Chop your logs!

Posted by Yoni Mizrachi Oct 6, 2007

If there is a first thing to check on a production server it must be the log configuration.

You will be amazed to know how just a few logs in INFO severity can cause your server to slow down (besides filling-up your valuable disk space). In the portal code there are many calls for writing log messages in different locations, it allows you to instantly collect info when you are in a problem. BUT, the appropriate severity setting for a production system should be "ERROR". If you don't have specific issue there is no need for the server to collect data for nothing. What's more - you can change the severity on the fly at any given time.

The way to change the severity levels is via the AdminTool, under server -> services -> Log Configurator. Make sure  that "ERROR" is defined for both "Categories" and "Locations" tabs and use the "Copy severity to subtree" button (See below). This is important since there may be some "INFO" hiding in lower levels. Don't forget to save your change and make sure you use the "apply to all server nodes" option.

 

image

 

I ran a 3 hours test to get some numbers for you, my base line was navigations test where all logs are in "ERROR" and then I just set the "com.sap.portal.prt" location to "INFO". Before reading next, care to guess the results? 

The CPU level for the server jumped by 20% (absolute number), response times were doubled, number of full GC events doubled and the log files were hundreds of MB is size... makes you think, isn't it?

Some techi stuff - The log method calls are creating complex String objects causing memory consumption and file system I/O when writing them to disk. They are designed to be completely ignored if the corresponding log severity is not active, so they won't add overhead to the server.

 

If you do run into a problem and need to change the log severity, try the following:

1. Activate only the locations you need - setting everything to INFO will collect huge amounts of data and make it very hard to get a clear picture from the logs.

2. If you want to reproduce the problem on production environment try to do it on an isolated server node (off the load balancer), this way you ensure that all collected data is relevant to the scenario you are running and no other users will be affected.

3. Document your changes and time-limit them - don't forget to set the log severity back to ERROR when you are done.

 

Until next time,

Yoni.

Yoni Mizrachi

Prologue

Posted by Yoni Mizrachi Oct 6, 2007

Hi, I wish to use this blog to raise some performance issues that you, our customers, may face during your work with the portal.

My plan is to start with the basics and continue to common issues that may be pain points, emphasizing on analysis of end user scenarios. Some of you may read my posts and say "oh, that's trivial", but others may be amazed by the effect it has on your server's performance. I hope, in time, it will be beneficial to you and you will use this to both optimize your system as well as to understand the "behind the scenes" of the different components.

To make it work better for you I will appreciate your involvement. So, share your knowledge, ask questions, comment and suggest new topics. After all, I'm doing it for you so let me know if it helps you or should I change direction. Please...

One last comment - performance is usually a compromise, trying to get the right balance between several different options. There are many variants and the most important is your user's scenario, there is no "one size fits all", so take it under consideration. Read, learn and tune but always remember - there is no replacement for a good common sense!

So, off we go!

Filter Blog

By date: