Networking
137 bites tagged Networking — interview questions with model answers, and 60-second explainers.
URLSession data vs download vs upload tasks
Data tasks buffer responses in memory for small API calls; download tasks stream to a file and support background transfers for large files; upload tasks send bodies from data or files and report… choosing the right URLSession task.
Architecting an L7 proxy in Go versus Rust
Go offers GC and cheap goroutines for fast delivery but tail-latency GC pauses; Rust offers ownership and async/await for predictable latency at higher complexity. ability to weigh systems trade-offs under real constraints.
Network read/write timeouts in Go vs Rust stdlib
Go uses SetReadDeadline/SetWriteDeadline as absolute times; Rust uses set_read_timeout/set_write_timeout as durations on TcpStream. stdlib IO timeout APIs and design philosophy.
Concurrent TCP server: Go goroutines vs Rust std::thread
Both accept in a loop; Go spawns a goroutine per connection (go handle(conn)); Rust spawns an OS thread (thread::spawn moving the stream). stdlib networking and concurrency.
What a service mesh solves
It adds traffic management, security via mTLS, and observability at the network layer through sidecars, beyond what plain Kubernetes offers. the purpose of a mesh.
Ingress resource vs Ingress controller
The Ingress resource is declarative routing rules; the controller is the running proxy (NGINX, etc.) that reads them and serves traffic. Separating config from the engine.
kube-proxy and iptables vs IPVS modes
Kube-proxy watches Services/endpoints and programs node rules so ClusterIP traffic is DNAT'd to a backend Pod; iptables uses sequential rule chains, IPVS uses a hash table with real… How Service virtual IPs actually route.
Debugging Service connectivity between Pods
Kubectl get endpoints to check the Service has Pod IPs (selector match); kubectl describe service to verify selector and ports; exec into the frontend to curl the Service DNS name. Systematic Service debugging.
Why Kubernetes Services exist
Pod IPs are ephemeral and change on reschedule; a Service gives a stable virtual IP and DNS name plus load balancing across healthy Pods via label selectors. Grasp of Pod IP instability.
Minimal objects to expose a stateless app
A Deployment to run and self-heal replicas plus a Service to give a stable endpoint, exposed externally via type LoadBalancer or NodePort, or an Ingress. mapping requirements to core objects.
What is the difference between a Service and an Ingress?
This tests L4 versus L7 networking abstractions. A good answer says Services load-balance to Pods internally while Ingresses route external HTTP to Services via a controller, then gives a path-based scenario.
How would you use Retrofit to GET /posts/{id} and key components?
This checks your understanding of Retrofit's three-layer setup. You need a data class for JSON parsing, an interface with @GET and @Path, and a Retrofit.Builder with baseUrl and a converter.
Handling Network Errors in React Native
Network errors are normal state, not bugs to silence. In React Native, every fetch should expect flakiness and surface a retry path. The footgun is treating a timeout as permanent failure and wiping optimistic local state.
Node.js DNS: lookup vs. resolve
Node.js splits DNS into two paths: dns.lookup uses getaddrinfo for IPs, while the dns.resolve family fetches records like MX or TXT. Use lookup for connections and the resolve family for service discovery.
How do you complete a file download after the app backgrounds?
This tests iOS background execution and URLSession background transfers. Configure a background URLSession, handle AppDelegate events, and respect the 30-second completion handler limit. Never claim NSTimer or beginBackgroundTask sustains background downloads.
UIViewController lifecycle states: network vs geometry updates
Tests UIViewController lifecycle states and separation of data vs layout. Strong answers list loadView to viewDidDisappear, start network in viewDidLoad or viewWillAppear, and geometry in viewDidLayoutSubviews. Red flag: network calls inside layout methods.
Build a TCP server in Go and Rust using standard libraries
Tests standard-library networking APIs in both languages. Strong answer: Go's net.Listen with Accept loop vs Rust's std::net::TcpListener::bind and incoming iterator. Red flag: reaching for HTTP or async frameworks instead of core TCP primitives.
TCP Listeners: Go vs Rust
Go spins up TCP listeners and handles connections with lightweight goroutines—1 million costs ~500MB—but GC pauses introduce 2-5ms latency. Rust trades boilerplate for zero-cost safety and consistent sub-100µs response times without garbage collection.
Why are stale search requests problematic and how do you cancel them?
This tests race conditions and resource waste in async UI. Strong answers note stale requests waste bandwidth and overwrite newer results; cancel the previous call with a CancelToken before issuing the next.
Explain Dio interceptors and automatic token refresh
Define interceptors as hooks; queue concurrent 401s during refresh; retry with Bearer header via token manager. Stateful middleware and async orchestration. Synchronous refresh or refresh storms.
Describe a robust error handling strategy for network requests
Tests whether you classify failures by layer rather than catching everything generically. Inspect DioExceptionType for connectivity, check HTTP status before parsing, and isolate JSON decode errors. Never show the same message for timeouts and 500s.
Flutter Network Errors: Fail Gracefully
Treat every network call as a promise that might break. In Flutter, catch exceptions at the HTTP boundary and map them to UI states like retry widgets. The footgun is letting Dio or http exceptions bubble up, crashing the app instead of degrading gracefully.
EndpointSlice: Splitting the Monolithic Endpoints List
EndpointSlice shards a service's pod backends into smaller chunks instead of one massive list. This keeps kube-proxy and DNS fast when services scale to thousands of pods. Do not edit them by hand; the controller owns them and will overwrite your changes.
What are liveness and readiness probes, and what happens when each fails?
This tests whether you know the distinct kubelet actions for each probe failure. A strong answer: liveness failure restarts the container; readiness failure removes the Pod from Service endpoints and stops traffic.
Get Networking bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
Open testing — you’ll join as an early tester.