Top 50 Haproxy Interview Questions with Answers

Haproxy Interview Questions with Answers

1. What is HAProxy?

a) A web server
b) A load balancer
c) A database
d) A programming language

Answer: b

2. What is the difference between HAProxy and Nginx?

a) HAProxy is a load balancer, while Nginx is a web server and reverse proxy.
b) HAProxy is a database, while Nginx is a web server and reverse proxy.
c) HAProxy is a programming language, while Nginx is a load balancer.
d) HAProxy and Nginx are the same thing.

Answer: a

3. What is the main feature of HAProxy?

a) Load balancing
b) Caching
c) Data storage
d) Authentication

Answer: a

4. What is the default port for HAProxy?

a) 80
b) 443
c) 8080
d) 9000

Answer: a

5. What kind of load balancing algorithms does HAProxy support?

a) Round-robin
b) Least connections
c) Source IP-based
d) All of the above

Answer: d

6. What is a backend in HAProxy?

a) The front-facing load balancer
b) The server(s) being load balanced
c) The user interface
d) The logging system

Answer: b

7. What is a frontend in HAProxy?

a) The server(s) being load balanced
b) The front-facing load balancer
c) The user interface
d) The logging system

Answer: b

8. What is the maximum number of servers that can be load balanced by HAProxy?

a) 10
b) 100
c) 1000
d) Unlimited

Answer: d

9. Can HAProxy be used for SSL termination?

a) Yes
b) No

Answer: a

10. What is the difference between a TCP and HTTP mode in HAProxy?

a) TCP mode is for load balancing TCP traffic, while HTTP mode is for load balancing HTTP traffic.
b) TCP mode is for load balancing HTTP traffic, while HTTP mode is for load balancing TCP traffic.
c) TCP mode is for caching, while HTTP mode is for load balancing.
d) There is no difference.

Answer: a

11. What is the command to reload HAProxy configuration?

a) systemctl start haproxy
b) systemctl stop haproxy
c) systemctl restart haproxy
d) systemctl reload haproxy

Answer: d

12. What is the purpose of a health check in HAProxy?

a) To monitor the availability of backend servers.
b) To monitor the performance of backend servers.
c) To monitor the amount of traffic being handled by HAProxy.
d) Both a and b.

Answer: a

13. What is the command to view the status of HAProxy backend servers?

a) haproxy -p /var/run/haproxy.pid -D -f /etc/haproxy/haproxy.cfg -c
b) haproxy -p /var/run/haproxy.pid -D -f /etc/haproxy/haproxy.cfg -t
c) haproxy -p /var/run/haproxy.pid -D -f /etc/haproxy/haproxy.cfg -n
d) haproxy -p /var/run/haproxy.pid -D -f /etc/haproxy/haproxy.cfg -stats

Answer: d

14. What is the difference between a sticky session and a non-sticky session in HAProxy?

a) Sticky session means a client always connects to the same backend server, while non-sticky means the client can connect to any backend server.
b) Sticky session means a client can connect to any backend server, while non-sticky means the client always connects to the same backend server.
c) There is no difference.
d) Sticky and non-sticky sessions only apply to Nginx, not HAProxy.

Answer: a

15. What is the maximum number of frontend listeners that can be configured in HAProxy?

a) 10
b) 100
c) Unlimited
d) None of the above.

Answer: c

16. What is the use of “option forwardfor” in HAProxy?

a) To pass the client’s original IP address to the backend server.
b) To encrypt the client’s original IP address.
c) There is no such option in HAProxy.
d) To disable logging of the client’s original IP address.

Answer: a

17. What is the maximum number of ACLs that can be configured in HAProxy?

a) 10
b) 100
c) Unlimited
d) None of the above.

Answer: c

18. What is the command to stop HAProxy?

a) systemctl start haproxy
b) systemctl stop haproxy
c) systemctl restart haproxy
d) systemctl reload haproxy

Answer: b

19. How can you add new servers to an existing HAProxy configuration?

a) Edit the configuration file manually and reload the configuration.
b) Restart HAProxy.
c) Run a separate process to automatically add servers as they come online.
d) There is no way to add new servers.

Answer: a

20. What is the purpose of a timeout in HAProxy configuration?

a) To limit the amount of time a client can connect to a backend server.
b) To limit the amount of time a backend server can process a request.
c) To limit the amount of time a client can connect to HAProxy.
d) Both a and b.

Answer: d

21. What is the command to check HAProxy configuration file syntax?

a) haproxy -p /var/run/haproxy.pid -D -f /etc/haproxy/haproxy.cfg -c
b) haproxy -p /var/run/haproxy.pid -D -f /etc/haproxy/haproxy.cfg -t
c) haproxy -p /var/run/haproxy.pid -D -f /etc/haproxy/haproxy.cfg -n
d) haproxy -p /var/run/haproxy.pid -D -f /etc/haproxy/haproxy.cfg -stats

Answer: b

22. What is the purpose of “option httpchk” in HAProxy?

a) To enable HTTP health checks for backend servers.
b) To encrypt HTTP traffic.
c) There is no such option in HAProxy.
d) To disable HTTP traffic.

Answer: a

23. What is the difference between “option httplog” and “option tcplog” in HAProxy?

a) “option httplog” is for HTTP traffic, while “option tcplog” is for TCP traffic.
b) “option httplog” is for TCP traffic, while “option tcplog” is for HTTP traffic.
c) There is no difference.
d) “option httplog” and “option tcplog” only apply to Nginx, not HAProxy.

Answer: a

24. What is the purpose of “option prefer-last-server” in HAProxy?

a) To always connect to the last backend server in a list.
b) To always connect to the first backend server in a list.
c) There is no such option in HAProxy.
d) To randomly select a backend server.

Answer: a

25. What is the use of “maxconn” in a backend server configuration?

a) To limit the maximum number of client connections per backend server.
b) To limit the maximum number of backend server connections per client.
c) There is no such option in HAProxy.
d) To limit the total amount of traffic between HAProxy and the backend server.

Answer: a

26. What is the major difference between round-robin and least connection algorithms in HAProxy?

a) Round-robin is a random algorithm that distributes the load equally among all servers while least connection algorithm assigns connections to the server with the least number of active connections.
b) Round-robin assigns connections to the server with the least number of active connections while least connection algorithm is a random combination of the weight assigned to all the servers.
c) None of the mentioned.
d) Both are identical for load balancing.

Answer: a

27. What is the command to kill a specific HAProxy process running in the background?

a) killall haproxy
b) pkill haproxy
c) kill pid_number
d) All of the above

Answer: c

28. What is the command to check the version of HAProxy?

a) haproxy -v
b) haproxy –version
c) Both a and b
d) systemctl status haproxy

Answer: c

29. What is the use of stick tables in HAProxy?

a) To store client information in a cache-like structure.
b) To limit the amount of traffic a client can send to a backend server.
c) To encrypt client data before sending it to a backend server.
d) Both a and b.

Answer: a

30. What is the difference between “balance roundrobin” and “balance leastconn” in HAProxy?

a) “balance roundrobin” distributes the load equally among all servers while “balance leastconn” assigns connections to the server with the least number of active connections.
b) “balance leastconn” distributes the load equally among all servers while “balance roundrobin” assigns connections to the server with the least number of active connections.
c) None of the mentioned.
d) Both are identical for load balancing.

Answer: a

31. What is the use of “option redispatch” in HAProxy?

a) To re-dispatch connections to another backend server if the current one fails.
b) To redispatch all connections after a server is added or removed from HAProxy configuration.
c) There is no such option in HAProxy.
d) To encrypt all traffic between the client and backend servers.

Answer: a

32. What is the purpose of “mode” option in HAProxy?

a) To select between TCP and HTTP modes.
b) To limit the maximum number of client connections per backend server.
c) To enable HTTP health checks for backend servers.
d) There is no such option in HAProxy.

Answer: a

33. How many types of cookies does HAProxy support?

a) 1
b) 2
c) 3
d) 4

Answer: b

34. What is the use of “server-template” in HAProxy?

a) To create multiple backend servers with the same configuration.
b) To limit the maximum number of client connections per backend server.
c) To enable HTTP health checks for backend servers.
d) There is no such option in HAProxy.

Answer: a

35. What is the use of “http-reuse” in HAProxy?

a) To reuse existing client connections to backend servers.
b) To limit the maximum number of client connections per backend server.
c) To enable HTTP health checks for backend servers.
d) There is no such option in HAProxy.

Answer: a

36. What is the purpose of “source” option in HAProxy?

a) To specify the IP address or CIDR range of incoming client connections.
b) To limit the maximum number of client connections per backend server.
c) To enable HTTP health checks for backend servers.
d) There is no such option in HAProxy.

Answer: a

37. What is the use of “transparent” option in HAProxy?

a) To enable IP transparency for incoming client connections.
b) To limit the maximum number of client connections per backend server.
c) To enable HTTP health checks for backend servers.
d) There is no such option in HAProxy.

Answer: a

38. What is the use of “stats” option in HAProxy?

a) To enable statistics reporting for HAProxy.
b) To limit the maximum number of client connections per backend server.
c) To enable HTTP health checks for backend servers.
d) There is no such option in HAProxy.

Answer: a

39. What is the use of “http-request” in HAProxy?

a) To add an HTTP header to incoming client requests.
b) To limit the maximum number of client connections per backend server.
c) To enable HTTP health checks for backend servers.
d) There is no such option in HAProxy.

Answer: a

40. What is the use of “http-response” in HAProxy?

a) To add an HTTP header to outgoing client responses.
b) To limit the maximum number of client connections per backend server.
c) To enable HTTP health checks for backend servers.
d) There is no such option in HAProxy.

Answer: a

41. What is the use of “option http-server-close” in HAProxy?

a) To terminate the TCP connection between the client and HAProxy after each request.
b) To terminate the TCP connection between the client and backend server after each request.
c) There is no such option in HAProxy.
d) To disable logging of HTTP requests.

Answer: a

42. What is the use of “option http-tunnel” in HAProxy?

a) To allow HTTP traffic to be tunneled over other protocols.
b) To limit the maximum number of client connections per backend server.
c) To enable HTTP health checks for backend servers.
d) There is no such option in HAProxy.

Answer: a

43. What is the use of “option abortonclose” in HAProxy?

a) To abort the connection between the client and HAProxy if the client closes the connection early.
b) To abort the connection between the backend server and HAProxy if the backend server closes the connection early.
c) There is no such option in HAProxy.
d) To abort all connections immediately.

Answer: b

44. What is the use of “option dontlog-normal” in HAProxy?

a) To disable logging of normal HTTP requests.
b) To enable logging of normal HTTP requests.
c) There is no such option in HAProxy.
d) To encrypt normal HTTP requests.

Answer: a

45. What is the use of “timeout connection” in HAProxy?

a) To limit the time between the client connecting and sending the first request.
b) To limit the time between a backend server completing the request and sending the response.
c) To limit the amount of time a client can keep an idle connection open.
d) Both a and b.

Answer: a

46. What is the use of “timeout server” in HAProxy?

a) To limit the amount of time a backend server can process a request.
b) To limit the time between the client connecting and sending the first request.
c) To limit the amount of time a client can keep an idle connection open.
d) Both a and c.

Answer: a

47. What is the use of “option httplog clf” in HAProxy?

a) To use Common Log Format for HTTP logging.
b) To use Extended Log Format for HTTP logging.
c) There is no such option in HAProxy.
d) To disable logging of HTTP requests.

Answer: a

48. What is the use of “http-request del-header” in HAProxy?

a) To delete an HTTP header from incoming client requests.
b) To add an HTTP header to incoming client requests.
c) There is no such option in HAProxy.
d) To enable logging of HTTP requests.

Answer: a

49. What is the use of “http-request set-header” in HAProxy?

a) To add an HTTP header to incoming client requests.
b) To delete an HTTP header from incoming client requests.
c) There is no such option in HAProxy.
d) To enable logging of HTTP requests.

Answer: a

50. What is the use of “http-response set-header” in HAProxy?

a) To add an HTTP header to outgoing client responses.
b) To delete an HTTP header from outgoing client responses.
c) There is no such option in HAProxy.
d) To enable logging of HTTP responses.

Answer: a

Ashwani Kumar
Latest posts by Ashwani Kumar (see all)
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x