Improve Your Website Web Vitals

Core Web Vitals metrics →

  1. Largest Contentful Paint → Frist

    Improving the Largest Contentful Paint (LCP) metric. Using a CDN reduces server response times, minimizing third-party scripts lowers JavaScript execution delays, optimizing images and videos enhances their load speed, and reducing HTTP requests overall boosts performance, making them all essential for better web loading efficiency.

  2. INP → interaction to next paint

  3. Cumulative Layout Shift → Visual Stabillity on a website, Font Change

Good Blogs on web performance →

https://www.dckap.com/blog/

https://bloggingwizard.com/page-load-time-statistics/#:~:text=“At the BBC we've,20.7 million users lost%2Fmonth

https://www.fastcompany.com/1825005/how-one-second-could-cost-amazon-16-billion-sales

Google Web Vitals

Web Vitals | Articles | web.dev

Largest Contentful Paint threshold recommendations

Interaction to Next Paint threshold recommendations

Cumulative Layout Shift threshold recommendations

  • Largest Contentful Paint (LCP): measures loading performance. To provide a good user experience, LCP should occur within 2.5 seconds of when the page first starts loading.

  • Interaction to Next Paint (INP): measures interactivity. To provide a good user experience, pages should have a INP of 200 milliseconds or less.

  • Cumulative Layout Shift (CLS): measures visual stability. To provide a good user experience, pages should maintain a CLS of 0.1. or less.

What is TBT?

The Total Blocking Time (TBT) metric measures the total amount of time after First Contentful Paint (FCP) where the main thread was blocked for long enough to prevent input responsiveness.

By default, Lighthouse stops monitoring TBT after Time to Interactive (TTI), as do some other lab tools that measure page load. See How does TBT relate to TTI?.

The main thread is considered "blocked" any time there's a Long Task a task that runs on the main thread for more than 50 milliseconds. We say the main thread is "blocked" because the browser cannot interrupt a task that's in progress. So in the event that a user does interact with the page in the middle of a long task, the browser must wait for the task to finish before it can respond.

Optimising Javascript

  1. Minification and Compression - Webpack/ Vite, Gzip

  2. Javascript File Loading → Script tag, defer, async

  3. Loops and iterations Optimisation → use forEach, map or reduce

  4. Dom manipulation optimizations → minimise dom operations, use document fragments

  5. Event Delegation → Event Bubbling to the parent element to reduce the no. of event listeners

  6. Use JS libraries and Frameworks → react, vue, and angular

Optimizing CSS

  1. Minification and Compression → Webpack/Vite,

    1. https://www.projectwallace.com/

    2. https://cssstats.com/

    3. https://makersaid.com/tools/css-performance-testing/

Opimizing Images →

<aside> 💡

Lazy Loading →

</aside>

Tips →

  1. Reduce IFrames

  2. Use Preload attribute

  3. Avoid Inline styles

  4. reduce cookies size → maximum 20

  5. page size → 1500KB

  6. minimise http requests → Like graphql

  7. Use PWA

Tips to improve your Chrome Core Vitals →

Chrome Dev Tools Performance Tab →

Server Side Bottlenecks →

Common issues →

inefficient database queries

slow third-party services → payment gateways,

insufficient hardware

server-side code

not-caching, not proper caching

Db optimization →

  1. Database Index → for data retrieval

  2. Denormalisation

  3. Materialised Views →

  4. Partitioning

  5. Connection Pooling

  6. Minimise Join operations

  7. Optimise where clauses

  8. Use Pagination

  9. Regular Database Updates

Query Execution Plan →

Detailed a blueprint the step and operations take plan to execute the query .

https://pganalyze.com/docs/explain/basics-of-postgres-query-planning

NOSQL database optimization →

Indexes allow the database to quickly locate and retrieve data.

Third Party services →

  1. Message Queue → Kafka, RabbitMQ

  2. Connection Polling

  3. Caching

  4. Backup integrations

Caching →

  1. Memcached

    Memcached is an open source in-memory caching system designed for high performance and distributed environments.

  2. Redis

    Redis is an in-memory data structure store that can function as both a database and a cache.

    It offers a rich set of data structures and supports advanced caching features such as data exploration,publishing and messaging, subscription and persistence options.

    Both Memcached and Redis offer mechanisms for cache invalidation, such as setting time based expiration

  3. Cache Invalidation

Microservices →

  • Modular, Deployment, Scalability,

  • Service Mesh → Istio, Linkered, and Consul

Algo Complexity →

  • Check the Algo Complexity in your code

Profiling →

Server Side Implementation

  • Data Types

  • Simple code

  • Use better Data structures

  • Performance Testing

Resources

https://gettaurus.org/

https://en.wikipedia.org/wiki/RAID

Network Stack →

image.png

    traceroute yourwebsite.com

Performance Monitoring and Planning Improvements →

https://www.npmjs.com/package/web-vitals

https://www.npmjs.com/package/node-os-utils

Database Monitoring → Queries/sec, Throughput, Compute Time, connection counts, storage usage, query time execution ,

Monitoring tools →

  • Prometheus

  • Grafana → dashboards

  • Datadog → Cloud based analytics

  • New Relic

  • Elastic → Search

  • Kibana

Notifications →

Set Alerts for monitoring performance issues, decrease downtimes, SLA Compliance,

Set Grafana with Promethesus with alert rules