Saturday 23 August 2014

The differnce between TCP and UDP

Notes to the blog:
http://www.javacodegeeks.com/2014/07/9-differences-between-tcp-and-udp-protocol-java-network-interview-question.html

This question what is the difference between TCP and UDP is often asked during the interviews. It is also important for sysadmin and program to understand for dairy work. Then we will explain what is the major differences we can see between the two protocols.

Connection-oriented vs Connectionless:

this is the essential differnce between TCP and UDP. The differnce also explains the other different points in the blog. when we say TCP is connection-oriented, it means the protocol itself controls and manages the connection session. It needs so-call 3-ways handshake and 4-ways termination. TCP also has many control packages such as SYN,ACK to for flow control. Meanwhile, UDP does not provide a 'connection' session for communication parties.

Reliability:

TCP is reliable as the application can assume TCP provides a reliable communication while UDP does not provide any  delivery guaruntee

Ordering:

TCP also guarantees order of message as it can get the sequence number from all the packages. while UDP does not care about the package sequence.

Data Boundary:

TCP does not preserve data boundary, UDP does.In TCP, data is sent as a byte stream, and no distinguishing indications are transmitted to signal message (segment) boundaries. On UDP, Packets are sent individually and are checked for integrity only if they arrived. Packets have definite boundaries which are honoured upon receipt, meaning a read operation at the receiver socket will yield an entire message as it was originally sent.

Speed:

In one word, TCP is slow and UDP is fast.

Heavy weight vs Light weight:

Because of the overhead mentioned above, Transmission control protocol is considered as heavy weight as compared to light weight UDP protocol. TCP header is longer than UDP headers.

Congestion or Flow control:

TCP does Flow Control. TCP requires three packets to set up a socket connection, before any user data can be sent. TCP handles reliability and congestion control. On the other hand, UDP does not have an option for flow control.

Different Applications:


because TCP and UDP provides different behaviour or characters, different application use either TCP or UDP as their transmission protocal. for example, HTTP and FTP, they use TCP while SIP, TFTP use UDP.

Wednesday 20 August 2014

some tips about MySQL query Optimization

1. use the index: for every SQL, use the explain statement to verify the execution plan.
2. dont use index for computing substatement
3. fine the search critieria as much as possible
4. create hash index on fields for min/max/count
5. do manual calculation on some nequalities

Thursday 7 August 2014

Python STL - OS

OS module.
os is a very important standard library (STL) in python for system admin,  sysadmin can use it to interact with OS.
Common os functions
#list the directory’s content
>os.listdir(“pathname”)
 #call shell script or external binary
>os.system(“commands”)

>>> to be continue 

Tuesday 5 August 2014

very good summary about linux system administrator interview questions

this is I prepared for the interview for Linux admin/System Engineer Technical questions:

1)      how to install Digital Certificates on apache/nginx
2)      Apache MPM types
3)      Linux symlink vs hardlink
4)      Linux run level (RHEL/Ubuntu)
5)      Linux static library link vs dynamic library link
6)      How to install software from source code and the meaning of each steps
7)      Files in /boot and their function
8)      The content in /etc/grub.conf
9)      Linux booting procedure
10)   MYSQL database creation and deletion
11)   MySQL primary key, unique key, foreign key
12)   MySQL b+ tree and hash index
13)   MySQL index advantage and disadvantage, how to create keys
14)   Select statement, left join, right join, inner join
15)   How to shutdown a linux box
16)   DHCP requests procedure
17)   What is a proxy and reverse proxy
18)   ASymmetric and Symmetric encryption method
19)   How to use ssh key to login to the system without a password (what’s the advantage)
20)   Some remote login security rules
21)   How to execute shell commands in MySQL
22)   Name some options of MySQLadmin
23)   What GUI tools you have used for MySQL admin
24)   How to generate a service for Linux
25)   RAID 0, 1, 5
26)   Name the method to copy a file from a linux server to another server
27)   Rsync working mode. How to setup an rsync environment
28)   Linux – how to enter the single user mode
29)   How kill works in linux, name a few common Signals in LINUX
30)   Describe the memory layout of a procedure
31)   Ext2 special file permission and ACL
32)   HDD layout? How about SSD
33)   What is the function of VFS
34)   List common Linux environment variables
35)   How does CDN work
36)   How to forbid the root user to login directly
37)   How to grant/revoke permissions to MySQL user
38)   How to change mysql user’s password
39)   OSI mode and TCPIP mode
40)   What is VLAN and it’s function
41)   Common HTTP method
42)   Common HTTP response code
43)   How to setup MySQL replication
44)   What is file’s magic number
45)   Linux file types
46)   Linux super lock content
47)   Linux inode content
48)   How ping works
49)   How tracert works
50)   DNS server type, records type
51)   How DNS query works
52)   TCP establishment and termination method
53)   TCP flags
54)   What is TCP half close
55)   TCP 2MSL function
56)   List the TCP timers
57)   The format of a standard URL
58)   How can you design an Web Server
59)   Web Server’s keepalive advantage and disadvantage
60)   The responsibility of a system administrator
61)   The difference between procedure and thread
62)   Procedure life cycle
63)   The priority of the process, nice value and RT
64)   How to track down a process
65)   How does strace/ltrace work
66)   Linux cache/buffer
67)   /etc/passwd, /etc/shadow difference
68)   How to lock a user
69)   How to add a disk to linux system and use it in production environment
70)   How to create file system (for example ext4)
71)   Explain the output of top command and the meaning of each field
72)   The difference between router and switch, what is layer 3 switch
73)   how to make the OS secure
74)   myISAM vs InnoDB
75)   what is ACID
76)   what is the isolation level
77)   explain the backup and restore for MySQL
78)   how to create user in mysql
79)   mysql log explaination
80)   explain what is PKI
81)   SSL establishment procedure
82)   List the file system Linux supports
83)   List the linux disk blocks
84)   What is init process and it’s function
85)   Explain the disk block types in linux
86)   LVS working method and common scheduler
87)   Linux should at least contains which file partitions
88)   How to add modules in Apache
89)   How to integrate Apache and Tomcat
90)   What’s the function of firewall
91)   NTFS vs FAT
92)   Hsrp vs vrrp
93)   Mysqldump common options
94)   Mysqlbinlog
95)   Common redundant method for network
96)   Apache’s tuning
97)   Windows build-in group and users
98)   File system common commands
99)   Yum configuration file and repo.d sample
100) The process status and flag
101) The baseline for linux performance (4 sub system)
102) Linux performance checking tools
103) iptables tables and chains
104) collion domain and broadcast domain
105) NAT types
106) IP private sections
107) how OSPF is working
108) swap related commands. How to setup swap partitions on the fly
109) which software Apache rely on?

110) How Apache and Nginx configure a virtual host