How Developers Can Improve User Experience Of Web Apps

Web ApplicationExpert from PayPal shares his tips for browser and server caching to optimize performance of web apps.

If you are a software developer who specializes in building web apps, especially in e-commerce — the onus rests on you to enable faster response from the website and deliver the best possible user experience.

At a TechGig.com webinar on how to build full-stack, internet scale apps, Kapil Sharma, senior manager, software development, PayPal, shared some tips for developers to improve scalability of web apps using browser and server caching techniques. Here is a lowdown…

Browser cache tips

If you cache a resource locally, on the client side it will decrease the load on the servers. This will lead to web pages loading faster leading to better user experience. To do this, use the following HTTP headers or attributes to enable caching and optimizing:

1.Expires: This header allows you to set a time stamp on the server side for some of your locally cached responses to be used till the resources expire. Such caching and reusing of previously fetched resources lead to significant optimisation of performance of the web apps.

2.Cache control: This attribute allows you to set in seconds the time window in which a resource can stay as cache resource on the client side without calling for a fresh pull. You can set this attribute to ‘public’ unless dealing with sensitive resources. This will enable caching in intermediate layers such as proxy servers and Content Delivery Network (CDN) servers. This makes obtaining resources faster, especially in cases where client browser caches are disabled.

3.Last modified: This browser caching control allows you to make only conditional GETs. Conditional GETs enable a client to ask a server about any change in a requested resource. Let us say if a client is pulling a resource as a hard pull. It means the resource is getting downloaded for the first time on the client side.

In such a case, the last modified time stamp can be configured on the apache web server that can guide the client that the next time the specific resource is required it can make a conditional GET request by including a time stamp called ‘if-modified-since’.

This allows the client to ‘pull’ the resource only if needed. It can still make a hop to the web server, which will return it to the client if the resource on the server side is same as on client side.

Use server side caching

It is common to use a caching layer on the server side to improve response time. But using the right combination of near, distributed and replicated cache is where the skill lies.

1.Near cache involves making available a small footprint of memory in the local node on which your client app is running. This enables getting user objects faster.

2.Distributed cache complements near cache. It lets you pull an object from the disk on the same local machine or go to the cluster of app cache nodes that have been distributed as part of the larger caching strategy.

3.Replicated cache is used when you have all the required objects placed on each node available for the client. This must be used when your app calls for zero latency access for every read – for instance in an e-commerce platform. Enabling this requires extremely sophisticated machines.

Source: Tech Gig

Leave a Reply

Your email address will not be published. Required fields are marked *