Code likh liya, test bhi kar liya — ab usse duniya tak pahunchana kaise hai, aur pahuchane ke baad zinda kaise rakhna hai. Poore week ke 6 lectures + slides ke notes, Hinglish mein.
6 videos, 4 bade topics:
Deployment = jo software system humne banaya hai, use aise "place" karna ki end users easily access kar saken (jaise web app ko server pe host karna, aur user URL se khole).
Monitoring = deployed application ki execution information ko capture aur analyze karna — users kaise use kar rahe hain, performance issues, errors, timeouts vagairah.
Sabse pehle ek word samajh lo: Environment = wo system (ya systems ka set) jo ek given software application ko execute karta hai. Developer code likhta hai, environment usse build karke executable banata hai jise log access karte hain.
Char types hote hain. Lecture mein ek important line hai: development, testing aur production toh usually har team ke paas hote hi hain — staging optional-ish hai par best practice hai.
Staging environment ki zarurat kyu? Seedha production pe push kyu nahi kar dete? — 30 second socho, phir neeche padho.
"Unit testing" ka jawab hamesha Development environment hai. "Integration + System testing" ka jawab Testing environment. "Performance/stress testing" ka jawab Staging. Ye teen alag-alag hain — MCQ mein exactly yahi ghumaya jata hai.
Staging se production tak code push karne ke tareeke. Teen strategies padhni hain: Blue/Green, Canary, aur Versioned.
Har dot ek user hai. Neeche tab select karo aur buttons dabao — router traffic kaise route karta hai, dekho.
New version ke liye ek alag naya production environment banao, current wale ko chhue bina. Blue = abhi ka live production. Green = naya version.
Blue/Green jaisa hi, par ek go mein sabko nahi — users ke chhote subset ko dheere-dheere naya version diya jata hai.
Users ko khud version choose karne do. Saare versions alive rakhe jaate hain. User update kar le toh use new version pe route kar do, warna wo purane pe hi raha.
| Strategy | Idea | Plus | Minus |
|---|---|---|---|
| Blue/Green | Naye version ke liye poora alag production env, phir router switch | Rollback easy | Do full environments maintain karne padte hain |
| Canary | Chhote user subset ko phased rollout (random / profile / region) | Risk kam, real users pe test | Multiple instances ek saath manage karne padte hain |
| Versioned | User khud version chunta hai, sab versions alive | User ko choice, forced update nahi | Multiple versions maintain karna padta hai |
Blue/Green aur Canary dono naye environment pe deploy karte hain — farq sirf itna hai ki traffic kitna shift hota hai. Blue/Green = sab ek saath. Canary = thoda-thoda. Aur A/B testing (aage aayega) canary deployment pe hi chalti hai.
Hosting = wo infrastructure jo applications ko host/deploy karne ke liye chahiye. Web apps usually server systems pe host hoti hain, clients wahan se service access karte hain.
Server 24×7, poore saal, bina unplanned downtime ke available rehna chahiye — khaaskar production mein, jahan real users aur real data hote hain. Data secure bhi rehna chahiye.
Neeche har option mein 4 layers hain: Server Hardware → Operating System → Web Server → Web Application. Jitne zyada layer aapke, utna control; jitne kam, utni asaani.
| Bare Metal | IaaS | PaaS | |
|---|---|---|---|
| Aap manage karte ho | Hardware, OS, web server, app | Web server, app | Sirf app |
| Examples | Apne rack/blade servers | DigitalOcean, AWS, Linode | Heroku, Google App Engine |
| Advantage | Highest performance | Cheaper, no maintenance overhead | Very easy to deploy |
| Disadvantage | Most expensive upfront + setup/maintenance effort | Apni-apni configurations; shared → performance suffer | Lack of control |
DigitalOcean humein hardware + operating system deta hai apni app host karne ke liye.
Droplet = DigitalOcean ka virtual machine ke liye term. (Video wale droplet mein 1 GB memory, 25 GB disk, Ubuntu 18.04 tha.)
Dashboard se bandwidth, CPU usage, disk I/O — sab monitor kar sakte ho.
Droplet banane ke steps (video ke hisaab se):
Ek simple Flask app (ek route, "hello world") ko Heroku pe deploy karne ka poora flow:
pip install flask gunicorn — gunicorn ek Web Server Gateway Interface (WSGI) hai, jise Heroku Python apps deploy karne ke liye use karta haipip freeze > requirements.txt — ismein saare packages aur unke version numbers aa jaate hain. Heroku isi file ko dekh kar modules install karta haiapp.py ke andar jo app variable hai use chalaoDo zaroori files: requirements.txt + Procfile.
heroku login # browser khulega, login karo git init # project mein git repo initialize heroku git:remote -a <app-name> # heroku ko remote repo bana do git add Procfile app.py requirements.txt git commit -m "initial commit" git push heroku master # push + deployment dono
Push karte hi remote pe build shuru: Python install, pip install, requirements.txt ke saare packages install; Procfile se samajh liya ki ye web app hai → launch → deployed. URL browser mein kholo, app chal rahi hogi.
Code change karna ho? Normal git process: file badlo → git add → git commit → git push heroku master. Har push pe wo commit bhi karega aur build+deploy bhi. Heroku dashboard pe build succeeded dikh jayega; metrics ke liye credit card chahiye; extra resources (data stores, caching, CMS) bhi add kar sakte ho. Google App Engine bhi similar process follow karta hai.
Deployment kitna important aur time-consuming hai ye ab tak samajh aa gaya — multiple logon ka code integrate karo, sufficiently test karo, aur bina bugs ke live environment pe sahi se deploy karo. CI = integration aur deployment process ko automate karna.
Ye exam mein list ke roop mein poochha jata hai — dohra lo.
Ek mainline / master branch rakho. Zyada log, zyada time isi branch pe kaam karein. New features ya bug fixes ke liye thodi branches chalengi, par default master hi ho.
Build mein compilation, files copy/move karna, database schemas banana — sab aata hai. Ye sab build tools se automate karo. Java mein Ant aur Gradle, Node.js mein Builder. Bas sahi configuration ke scripts likhne padte hain.
Automated tests banao jo code base ke bade hisse ko bugs ke liye check karein. Ek simple command test suite chala de. Test fail ho toh us module ke responsible developer ko notification jaana chahiye.
Kam commit karoge toh conflict errors zyada aayenge (jab doosron ne wahi code badla ho). Frequent commits developers ko kaam chhote-chhote chunks mein todne ke liye encourage karte hain.
CI server repository ko monitor karta hai. Commit hote hi naya code pull, build, integration testing, aur committer ko notify — sab pass toh build successful.
Broken build fix karna developers ki priority honi chahiye. Aur system ko last-known good build pe wapas le jaao, taaki baaki developers ko sahi code base mile aur error unke code tak na phaile.
Deployment ko automate karne wale scripts likho — jaise staging environment pe deployment. Isse latest code hamesha staging pe available rehta hai.
JenkinsCruiseControl — CruiseControl ka dashboard builds ki list dikhata hai: kaunse pass/fail hue, kitni duration lagi, kisne modifications kiye, waghera.
Build tools alag hain: AntGradleBuilder — inhe CI servers ke saath mat mila dena.
Continuous Integration ke benefits kya hain — end users ke liye, developers ke liye, organization ke liye?
Sirf ek: processes set up karne ka initial effort — integration server lagana, logon ko train karna, sab mein time lagta hai. Par zyadatar cases mein advantages drawbacks se kahin zyada hain.
Code deploy ho gaya — ab performance acceptable standards pe honi chahiye. Teen bade tareeke: Caching, Task Queues, aur pages ko jaldi load/render karna.
Common operations ke results ko memory mein store kar lena, taaki har baar database se na laana pade. Memory se lana zyada fast hai aur servers pe load kam hota hai. Common queries agar baar-baar chalti hain aur DB mein koi change nahi hua, toh memory se serve kar do.
Tools: MemcachedRedis
Application badi hoti hai toh bahut saare resource aur time consuming tasks aate hain — hazaron users ko email/notification bhejna, bulk database records create/update karna (jaise user delete karo toh uska saara associated data delete karo). Ye tasks turant execute karna zaroori nahi — user ko bata do ki ho jayega aur baad mein notification bhej do.
Iske liye asynchronous work queue use hoti hai. Asynchronous isliye kyunki ye normal HTTP request–response cycle ke bahar execute hoti hai.
Kyu zaroori hai? Normal cycle mein: request → server process kare → email bheje → response de. Par hazaron users ko email bhejne ke liye user ko itni der wait nahi karwa sakte. Isliye task queue mein daal do.
Note: ek nahi, kai workers queue se jobs uthate hain aur kaam baant lete hain → bahut kam time. Aur agar zyada traffic expect kar rahe ho toh workers ka pool dynamically badha sakte ho.
Web apps mein bahut saara static content hota hai — HTML, CSS, JavaScript, images. Inka jaldi load hona bahut zaroori hai.
Kyu? Kyunki evidence hai: mobile delays se hone wala stress level horror movie dekhne ke barabar hota hai (Ericsson study wali famous slide). Users bas kuch seconds extra mein hi uncomfortable aur agitated ho jaate hain.
2016: AliExpress ne apni site ki speed 30% badhayi → customer orders 10.5% badh gaye.
2006: Google ne search results ko sirf half a second slow kiya → user requests 25% gir gaye.
Minify matlab code se saare spaces, tabs, extra white-space hata dena (aur parameter names tak chhote kar dena). Slide wale simple Fahrenheit→Celsius JavaScript function mein hi ~41% ki saving hui — aur ye toh ek chhota function tha. Poori site pe ye add up hoke bada farq banata hai.
function ftoc(f) {
var celsius = (f - 32) * 5 / 9;
return celsius;
}
— minify dabao —
Static pages ko compress karo. Tools: BrotliGzip
Testing aur staging mein sab theek tha, phir bhi live environment mein issues aa sakte hain. Isliye deploy ke baad constant monitoring zaroori hai.
Peak times pe CPU kitna use ho raha hai?
RAM par kitna load aa raha hai?
Database-intensive activities se disk bhar gaya toh naya data add nahi hoga → users ko errors.
Latency = user ko response milne mein kitna time lagta hai. Periodically check karna padta hai.
In sab ke basis pe development aur operations teams respond karke problems fix karti hain.
Inhe URL do, ye page resources analyze karke optimization suggestions dete hain, SEO aur accessibility metrics check karte hain, aur ek performance score calculate karte hain.
Example: Lighthouse — Google ki service, Chrome extension ke roop mein install hoti hai. Speed index jaise kai metrics deti hai.
| Metric | Matlab |
|---|---|
| Clickstreams | Users sabse zyada kaun se page sequences visit karte hain? Website mein kai paths hote hain — kaun sa path sabse zyada liya ja raha hai? |
| Think time / Dwell time | Ek typical user ek given page pe kitni der rukta hai? |
| Abandonment | Ek flow ko beech mein chhodne wale users ka percentage. Slide ka flow: Product page → Buy Now → Add address → Add payment → Pay. Flow complete karna business ke liye desirable hai; beech mein chhodna = us customer ka business loss. |
Kaam kaise karte hain: site ke har page mein JavaScript ka chhota piece embed kar do. Ismein tracking code hota hai jo page load hote hi information analytics tool ko bhej deta hai.
Example: Google Analytics — har interaction ke baad ke metrics deta hai, kahan drop-off ho raha hai wo bhi. Bas account sign up karo aur proper tracking code website mein daal do.
Version A mein kuch issues hain (maan lo abandonment zyada hai). Toh Version B banao — naya workflow ya better UI. Ab canary deployment (incremental rollout) karo: kuch users ko A, kuch ko B.
Dono versions monitor karo aur dekho kaun better hai. "Better" ka matlab ho sakta hai: zyada traffic, zyada dwell time, zyada sales, kam abandonment.
A/B testing = Canary deployment + Monitoring metrics. Ye do topics ka joint question ban sakta hai.
Quiz se 10 minute pehle bas ye padh lo.
| Concept | Ek line mein |
|---|---|
| Development env | Developer ka local machine + IDE + local DB; unit testing yahan |
| Testing env | Integration + system testing; fail hua toh code hatao, developer notify, previous version pe rollback |
| Staging env | Production ki exact replica, remote machine; pre-production; performance/stress testing + feature preview |
| Production env | Live environment, real users, real data |
| Blue/Green | Naya alag production env; router se full switch; rollback easy; blue-green cycle karte hain |
| Canary | Chhote subset ko phased rollout (random/profile/demographics/region); multiple instances manage karna padta hai |
| Versioned | User version chunta hai, sab versions alive; multiple versions maintain karne padte hain |
| Bare metal | Highest performance; most expensive upfront + setup/maintenance |
| IaaS | Hardware+OS provider ka; 8-core/32GB → 8 VMs of 1 core/4 GB; DigitalOcean, AWS, Linode; cheaper, no maintenance; shared → performance suffer |
| PaaS | Software layer bhi provider ka; Heroku, Google App Engine; very easy to deploy; lack of control |
| Droplet | DigitalOcean ka VM |
| Procfile | Heroku ko batata hai app kaise run karni hai |
| requirements.txt | Packages + version numbers ki list, jo Heroku install karta hai |
| gunicorn | WSGI — Heroku Python apps deploy karne ke liye use karta hai |
| CI process | commit → CI pull → build+test → ready to deploy → deploy server pull → build,test,deploy → notify complete |
| CI servers | Jenkins, CruiseControl |
| Build tools | Ant, Gradle (Java), Builder (Node.js) |
| Broken build | Turant fix; last-known good build pe rollback |
| CI drawback | Initial setup effort |
| Caching | Memcached, Redis; levels — browser, web server page cache, DB query cache |
| Task queue | Asynchronous, HTTP request-response cycle ke bahar; queue of jobs + pool of workers |
| Minify | Spaces/tabs hatao (~41% saving example); Compress = Brotli, Gzip |
| Numbers | AliExpress 30% faster → +10.5% orders; Google 0.5s slower → −25% requests |
| Lighthouse | Report generating tool — performance score, SEO, accessibility |
| Behaviour metrics | Clickstream, dwell/think time, abandonment |
| Analytics | Har page mein JS tracking code embed; e.g. Google Analytics |
| A/B testing | Canary deployment se A aur B chalao, metrics compare karo |
Neeche 24 questions hain, IITM graded assignment ke pattern mein (MCQ + MSQ). Option pe click karo → turant sahi/galat + explanation. Sab lecture content se hi bane hain.
CI server ≠ Build tool. Jenkins/CruiseControl = CI servers. Ant/Gradle/Builder = build tools.
Testing env ≠ Staging env. Integration/system testing → testing env. Performance/stress testing aur feature preview → staging env.
IaaS ≠ PaaS. DigitalOcean/AWS/Linode = IaaS. Heroku/Google App Engine = PaaS. PaaS web server aur DB bhi khud set karta hai.
Minify ≠ Compress. Minify = whitespace/tabs hatana. Compress = Gzip/Brotli se file compress karna. Dono alag steps hain.
Canary ka drawback = multiple instances. Versioned ka drawback = multiple versions. Wording dhyaan se padhna.
Blue/Green ka poochha jaye "biggest advantage" → hamesha easy rollback.