Posts

Showing posts from April, 2018

Xcode Shortcut

Image

System Design

https://github.com/donnemartin/system-design-primer Load Balancer Web Server Database Cache Scaling of hardware Horizontal  addition of new machine like new server pc Vertical addition of new hardwares in same machine like increasing ram and hdd Performance vs scalability If you have a  performance  problem, your system is slow for a single user. If you have a  scalability  problem, your system is fast for a single user but slow under heavy load. Availability vs consistency CAP In a distributed computer system , you can only support two of the following guarantees: Consistency  - Every read receives the most recent write or an error Availability  - Every request receives a response, without guarantee that it contains the most recent version of the information Partition Tolerance  - The system continues to operate despite arbitrary partitioning due to network failures Networks aren't reliable, so you'll need to support partition toleran

Thread & Locks

Image
Threads Threads are subunits of processes, which can be scheduled independently by the operating system scheduler. Multiple threads can be executed at the same time on a single CPU core. The operating system assigns small slices of computing time to each thread, so that it seems to the user as if multiple tasks are executed at the same time. If multiple CPU cores are available, then multiple threads can be executed truly in parallel. We can either use the POSIX thread API, or the Objective-C wrapper around this API, NSThread. NSThread is a simple Objective-C wrapper around pthreads. Grand Central Dispatch With GCD you don’t interact with threads directly anymore. Instead you add blocks of code to queues, and GCD manages a thread pool behind the scenes. GCD decides on which particular thread your code blocks are going to be executed on, and it manages these threads according to the available system resources. This alleviates the problem of too many threads being cre

Networking

Image
DNS Server On a typical small or home network, the DNS server IP addresses are often the same as the default gateway address. Devices send their DNS queries to your router, which then forwards the requests on to whatever DNS servers the router is configured to use. https://www.cyberciti.biz/faq/how-to-find-out-dns-for-router/ PING ping operates by sending  Internet Control Message Protocol  (ICMP) echo request  packets  to the target host and waiting for an ICMP echo reply. The program reports errors,  packet loss , and a statistical summary of the results, typically including the minimum, maximum, the  mean  round-trip times, and  standard deviation  of the mean. ping requests host if it is alive and print required time to get a response from that host server. ping www.google.com check dns server nslookup www.google.com host  www.google.com To view dns traffic run tcpudmp as root # tcpdump udp and src port 53 # tcpdump udp and dst port 53 # tcpdump -n -s 1500 -i