Gopher Academy
3.34K subscribers
918 photos
40 videos
279 files
1.99K links
🕸 Gopher Academy

🔷interview golang
https://github.com/mrbardia72/Go-Interview-Questions-And-Answers

حمایت مالی:
https://www.coffeete.ir/mrbardia72

ادمین:
@mrbardia72
Download Telegram
How can Redis be used?
There is more to Redis than just caching.
.
Redis can be used in a variety of scenarios as shown in the diagram.

🔹Session
We can use Redis to share user session data among different services.

🔹Cache
We can use Redis to cache objects or pages, especially for hotspot data.

🔹Distributed lock
We can use a Redis string to acquire locks among distributed services.

🔹Counter
We can count how many likes or how many reads for articles.

🔹Rate limiter
We can apply a rate limiter for certain user IPs.

🔹Global ID generator
We can use Redis Int for global ID.

🔹Shopping cart
We can use Redis Hash to represent key-value pairs in a shopping cart.

🔹Calculate user retention
We can use Bitmap to represent the user login daily and calculate user retention.

🔹Message queue
We can use List for a message queue.

🔹Ranking
We can use ZSet to sort the articles.

#systemdesign #coding #interviewtips


🔰 @gopher_academy
🔥1🕊1
یه مقاله خیلی جذاب از #netflix در رابطه با #false_sharing
ماجرا از این قراره که نتفلیکس اینستنس های یکی از میکرو سرویس هاش رو ارتقا میده
از m5.4xl (16 vCPUs) به m5.12xl (48 vCPUs)
خب چون این دو تا ماشین یه اختلاف سه برابری توی قدرت پردازش دارند انتظار میرفت که یه عدد نزدیک سه برابری هم توی خروجی داشته باشند. (RPS)

اما نتیجه فقط بهبود 25 درصدی رو نشون میداد!
حتی بدتر از اون #latency یه افزایش 50 درصدی هم پیدا کرد!

اینکه مشکل از کجا بود و چه خاکی به سر ریختن
از اینجا خودتون بخونید 😁

https://lnkd.in/eYh5Q46J


🔰 @gopher_academy
👍3👌1
Why is Nginx called a “𝐫𝐞𝐯𝐞𝐫𝐬𝐞” proxy?
.
.
The diagram below shows the differences between a 𝐟𝐨𝐫𝐰𝐚𝐫𝐝 𝐩𝐫𝐨𝐱𝐲 and a 𝐫𝐞𝐯𝐞𝐫𝐬𝐞 𝐩𝐫𝐨𝐱𝐲.

🔹 A forward proxy is a server that sits between user devices and the internet.

A forward proxy is commonly used for: 
1️⃣ Protect clients
2️⃣ Avoid browsing restrictions
3️⃣ Block access to certain content

🔹 A reverse proxy is a server that accepts a request from the client, forwards the request to web servers, and returns the results to the client as if the proxy server had processed the request.

A reverse proxy is good for:
1️⃣ Protect servers
2️⃣ Load balancing
3️⃣ Cache static contents
4️⃣ Encrypt and decrypt SSL communications

 —
#systemdesign #coding #interviewtips


🔰 @gopher_academy
2👍1🏆1
Data structure that power your database

🔰 @gopher_academy
https://t.me/gopher_academy/1485
👇👇👇👇👇👇👇
👍21🕊1
8 Data Structures That Power Your Databases. Which one should we pick?

The answer will vary depending on your use case. Data can be indexed in memory or on disk. Similarly, data formats vary, such as numbers, strings, geographic coordinates, etc. The system might be write-heavy or read-heavy. All of these factors affect your choice of database index format.

The following are some of the most popular data structures used for indexing data:
🔹Skiplist: a common in-memory index type. Used in Redis
🔹Hash index: a very common implementation of the “Map” data structure (or “Collection”)
🔹SSTable: immutable on-disk “Map” implementation
🔹LSM tree: Skiplist + SSTable. High write throughput
🔹B-tree: disk-based solution. Consistent read/write performance
🔹Inverted index: used for document indexing. Used in Lucene
🔹Suffix tree: for string pattern search
🔹R-tree: multi-dimension search, such as finding the nearest neighbor

#systemdesign #coding #interviewtips

🔰 @gopher_academy
👍1👏1
بر خلاف نظر خیلی هاتون، این نوع کد زدن جزو تمیز ترین کد زنی هاست، ریفکتور ساده و خوانایی بسیار بالایی داره.

میشه همین تکه کد رو خیلی خیلی کوتاه تر نوشت و تو دو خط خلاصه کرد، اما به هیچ وجه خوانایی این کد رو نداره.

سنجش تمیزی یک کد با  WTF/m محاسبه میشه، احتمالا وقتی این رو دیدید هیچ کدومتون نگفتید این چیه و چیکار میکنه، چون کاملا واضحه کارکردش.

همیشه کوتاه نوشتن، مبنی بر بهتر بودن نیست. به این فکر کنید که نفر بعدی چقدر باید زمان برای ریفکتور بذاره.


🔰 @gopher_academy
👌12👎3💔2💯1
کتابخانه zapper نوشتن لاگ اما آسان ...

کتابخانه zapper یک نمونه wrap شده از کتابخانه zap می باشد که امکان پیاده سازی انواع لاگ ها را برای شما فراهم می کند. کتابخانه zapper دارای چندین هسته آماده برای پیاده سازی لاگ در محیط های مختلف می باشد و کار با zap را برایتان ساده تر میکند.

قابلیت ها :
- دارای هسته console, file, sentry, json
- نمایش stacktrace در لاگ ها با تعیین Level لاگ
- امکان پیاده سازی فایل لاگ بصورت rotation
- ارسال لاگ به سرویس سنتری
- راه اندازی همزمان چندین هسته در کنار هم برای نگه داری و مدیریت لاگ ها
- تنظیم اطلاعات سرویس نظیر کد و نام سرویس

این کتابخانه تازه نوشته شده و بزودی هسته های کاربردی بیشتری ارائه میشه.

مخزن : https://github.com/GoFarsi/zapper
داکیومنت : https://pkg.go.dev/github.com/GoFarsi/zapper


🔰 @gopher_academy
👍8🕊2
Code complexity vs. Experience 

🔰 @gopher_academy
👏82👍1👀1
#نظرسنجی

دیروز یکی از دوستان تو لینکدین ازم سوال کرد در چه مواقعی و چه جاهایی از سطح Debug در Logger ها استفاده کنیم؟

در قالب کامنت به این موضوع پاسخ دهید تا یک جمع بندی درست از تجربیات همه کسب کنیم.


🔰 @gopher_academy
🌚3👎1
دوستان برنامه نویس فعلا نگران ChatGTP نباشید که شغلتون رو ازتون بگیره، کدهایی که می‌نویسه کلی اشتباه داره و وقتی بهش اشتباهشو رو گوشزد می‌کنی یه معذرت خواهی می‌کنه و دوباره یه کد اشتباه دیگه تحویل میده

<Yashar Rashedi/>


🔰 @gopher_academy
🍓6👍5🎃4🌚2🤝2👎1🐳1👀1🗿1
Redis use cases

🔰 @gopher_academy
👍5👏1
💙 درود به همگی چند ماه پیش تصمیم گرفتم توی مواردی که خیلی باهاش سروکار دارم نمونه سوالتش رو از بعضی  سایت ها و یا استک اور فلو بهش برخوردم رو توی ریپوهای زیر جداگانه جمع آوری کنم
اگر دوس داشتید به اشتراک بزارید  و حمایت و مشارکت کنید

❤️سپاس از توجه شما بزرگوارن آریایی 

نمونه سوالات مصاحبه ای گیت
▶️ https://github.com/mrbardia72/git-Interview-Questions-And-Answers

نمونه سوالات مصاحبه ای گولنگ
▶️ https://github.com/mrbardia72/Go-Interview-Questions-And-Answers

نمونه سوالات مصاحبه ای دیتابیس
▶️ https://github.com/mrbardia72/db-Interview-Questions-and-Answers

نمونه سوالات مصاحبه ای داکر
▶️ https://github.com/mrbardia72/docker-Interview-Questions-and-Answers

نمونه سوالات مصاحبه ای والت
▶️ https://github.com/mrbardia72/vault-Interview-Questions-and-Answers


🔰 @gopher_academy
🤩71👍1👀1
Hello gophers,

We have just released Go 1.20.

To find out what has changed in Go 1.20, read the release notes:
https://go.dev/doc/go1.20

You can download binary and source distributions from our download page:
https://go.dev/dl/#go1.20

If you have Go installed already, an easy way to try go1.20
is by using the go command:
$ go install golang.org/dl/go1.20@latest
$ go1.20 download

To compile from source using a Git clone, update to the release with
git checkout go1.20 and build as usual.

Thanks to everyone who contributed to the release!

Cheers,
Michael, Matthew, and Dmitri for the Go team

🔰 @gopher_academy
🕊31
Gopher Academy pinned «💙 درود به همگی چند ماه پیش تصمیم گرفتم توی مواردی که خیلی باهاش سروکار دارم نمونه سوالتش رو از بعضی  سایت ها و یا استک اور فلو بهش برخوردم رو توی ریپوهای زیر جداگانه جمع آوری کنم اگر دوس داشتید به اشتراک بزارید  و حمایت و مشارکت کنید ❤️سپاس از توجه شما بزرگوارن…»
دوستان پکیج arena هنوز experimental هستش و احتمالا در نسخه ۱.۲۱ رسماً در دسترس باشد.

شما با استفاده از این پکیج می توانید بخشی از حافظه برای یک آبجکت بصورت اختصاصی allocate کنید سپس بدون نیاز به garbage collector حافظه را با arena آزاد کنید.

استفاده از این پکیج باعث می شود ۱۵ درصد مصرف رم و سی پی یو کاهش یابد.

https://github.com/golang/go/issues/51317

اما اگر میخواهید از این پکیج استفاده کنید goexperiment.arenas برروی IDE Goland اضافه کنید.

Preferences/Settings | Go | Build Tags & Vendoring | Custom tags

اما اگر بخواهید بیلد بگیرید بهتره environment زیر را هنگام بیلد یا ران اضافه کنید.

GOEXPERIMENT=arenas go run main.go


توجه کنید پکیج memory arena بصورت unsafe با مموری کار می کند و هنوز experimental هست و گارانتی وجود ندارد کاملا safe باشد تا نسخه ۱.۲۱ باید صبر کنید اما برای تست طبق روش فوق در دسترس است.


🔰 @gopher_academy
👍4
Algorithm Applications.pdf
398.1 KB

🔰 @gopher_academy
👍2💋2
Learn how the Kubernetes ingress works.pdf
10.6 MB
Kubernetes ingress

🔰 @gopher_academy
👍3🐳1
Data races in Go(Golang) and how to fix them

https://www.sohamkamani.com/golang/data-races/


🔰 @gopher_academy
👍1🌭1🏆1
‏یکی اومده راه‌حل سوالایی که برای آمادگی برای مصاحبه گوگل حل کرده رو توی گیت‌هاب گذاشته.

برای آمادگی، حدود ۲۲۲ سوال از leetcode حل کرده.

برخی از نکاتی که نوشته:

۱. حل مساله فقط بخشی از آمادگی برای مصاحبه است، هرچند این بخش خیلی مهمه، ولی علاوه بر اون به نکات بعدی هم دقت کنید.
‏۲. با مفاهیم علوم‌کامپیوتر آشنا باشید تا زبان مشترکی بین شما و مصاحبه‌کننده برقرار باشه
۳. سر مصاحبه باید بتونید «روند فکر کردنتون» رو توضیح بدین. برای آشنایی با این بخش، کتاب «Cracking the Coding Interview» رو توصیه کرده.

و یه سری مطلب دیگه که توی گیت‌هابش می‌بینید.

https://github.com/mgechev/google-interview-preparation-problems

@DevTwitter | <hadi/>
👍5🕊1👀1