Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the methods of Docker optimization

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article focuses on "what are the methods of Docker optimization", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "what are the methods of Docker optimization"!

one。 Introduction

Unlike the previous introduction of Crane, the cloud gang from good Rain Cloud (GoodRain) (CloudHelp has now been renamed RainBond) is based on K8S. To be honest, it feels better than Crane's open source attitude. Crane, no one has replied to my issue so far. I think it's cold.

For the positioning of the cloud gang, please refer to the official FAQS.

Q: what is the positioning of the open source version of Yungang? A: CI/CD platform for small and medium-sized enterprises, application management platform for production environment. Cloud gang is not to close the gap between developers and operators, but to let developers and operators do what they are supposed to do. The developer is responsible for the program and business, the operation and maintenance is responsible for the resources, and the cloud gang acts as the assistant of the development and operation and maintenance. Q: what is the purpose of releasing the open source version? A: I hope that more enterprises and individual enthusiasts can enjoy the efficiency and convenience brought by container and cloud computing technology. Through the community version to let the majority of users understand the design concept of Yunbang products. Q: open source development plan A: Yunbang is a platform-level product. Even if it is an open source version, our primary concern is stability. The product design will lower the threshold for use based on the principle of simplicity and adequacy of features. Let users experience the dividends brought by container technology in the simplest way. Q: is there a case of production environment running in Yungang Enterprise Edition? Is the open source version just a toy for demonstration and testing? A: speaking of this question, I think we need to clarify what criteria are used to judge the operation of a technology or product in a "production environment". It is only when this standard or definition is clearly defined that it makes sense to discuss this issue. We explain from four aspects: stability, maintainability, expansibility and support service: 1. Stability: cloud help public cloud is actually a set of cloud help enterprise version that we run on top of the public IaaS platform. Yunbang public cloud has been online for more than 700 days, and there has not been a single accident caused by the underlying program. The SLA can reach 99.999%. The core code of the open source version of the basic module is 100% consistent with that of the enterprise version. two。 Maintainability: cloud help basic technology unit is Docker, service choreography and scheduling use kubernetes, these two software are currently the most concerned open source projects, documentation and technology community are very mature. We use Docker image to package other modules of cloud gang, and make use of the high availability mechanism within kubernetes to ensure high availability. Therefore, the maintenance cost of the platform is very low, coupled with many years of platform maintenance experience of the Haoyu technical team, the deployment and monitoring system of the cloud gang are very perfect. 3. Scalability: cloud help platform Yunsheng supports distributed deployment. With the container scheduling mechanism of kubernetes, thousands of containers can be started and stopped in seconds. The platform container host also supports dynamic scaling, and the new container host can be launched within 3 minutes. 4. Service support: for the open source version, we provide timely product update services, platform bug, security patches will be fixed as soon as possible according to the development progress. Provide community, Wechat / QQ group online support, and provide complete documentation support. In addition, the cloud help enterprise version is mainly a privatization project, and more than 100 enterprises have deployed the enterprise version, such as zdoo.com, Yaoji Lottery Network and so on. Yunbang Community Edition also has many small and medium-sized enterprises running in the production environment.

Among other things, we can see that the cloud gang will continue to maintain, at least not suddenly cool, not open source toys, so if you need a K8s-based management platform, cloud gang may also be a choice.

two。 Installation

The preparation work directly look at the official documents why there are 3.4 and 3.5, because I put this tutorial for a while, and then found that the official release 3.5. Then I'll introduce 3.5. After all, 3.4 is a little more experimental.

To sum up:

CentOS7's system (must be systemd, Debian theoretically works, but CentOS7 is recommended)

Adequate configuration (not low configuration is required, the actual use of the recommended cluster)

NTP proofing (configure ntpd and modify time zone)

The server must be configured with static IP to ensure that IP does not change after restarting because of DHCP

The environment is clean (it is officially recommended to uninstall all Docker and kubelet before coming back)

It is best not to modify hostname after installation (if necessary, please modify / etc/host and / etc/hostname at the same time, and make sure that each node does not repeat)

# install Cloud bash Portal

I will only introduce the basics here.

This is deployed directly from the official example. What you need to know is that each cloud gang will be assigned a second-level domain name by Haoyuyun and resolved to your node, so the access uses that domain name. It seems that it can be changed by modifying the WILD_DOMAIN in / etc/goodrain/console.py, but it is not sure whether it is feasible.

In addition, not to mention the creation of applications from Dockerfile, DockerCompose, etc., go and play by yourself. This doesn't give you too many options in my opinion, the panel just exists as application management, the settings (server and so on) are all fixed for you (automatic configuration), maybe the enterprise version has more settings, but it seems to me that it is enough, you don't have to worry about it, maybe it's just what the team or company needs.

three。 Optimize

1. Modify the file descriptor limit

Vi / etc/security/limits.conf# adds the following content: root soft nofile 102400root hard nofile 102400 * soft nofile 102400 * hard nofile 102400

You need to restart if you want to take effect.

2. Kernel parameter tuning

Vi / etc/sysctl.conf# adds the following content net.ipv4.neigh.default.gc_stale_time=120net.ipv4.conf.all.rp_filter=0net.ipv4.conf.default.rp_filter=0net.ipv4.conf.default.arp_announce=2net.ipv4.conf.all.arp_announce=2net.ipv4.tcp_max_tw_buckets=5000net.ipv4.tcp_syncookies=1net.ipv4.tcp_max_syn_backlog=1024net.ipv4.tcp_synack_retries=2net.ipv6.conf.all.disable_ipv6=1net.ipv6.conf.default.disable_ Ipv6=1net.ipv6.conf.lo.disable_ipv6=1net.ipv4.conf.lo.arp_announce=2vm.swappiness=10vm.vfs_cache_pressure=50vm.overcommit_memory=1 net.core.somaxconn = 65535net.netfilter.nf_conntrack_max = 655350net.netfilter.nf_conntrack_tcp_timeout_established = 1200 # make the changes take effect immediately sysctl-p

3. Increase the number of concurrent NFS mounts

Vi / etc/sysctl.conf# adds the following content sunrpc.tcp_slot_table_entries = 128# to make the changes take effect immediately sysctl-p

4. Restrictions on the use of swap for opening containers

If you specify only-m instead of-- memory-swap when starting the container, then-- memory-swap defaults to twice-m, such as

Docker run-it-m 200m image

Indicates that the container uses up to 200m of physical memory and 200m of swap. If you prompt the following error, it may be because cgroup is not enabled by default on the host to restrict swap partitions

WARNING: Your kernel does not support swap limit capabilities, memory limited without swap.

You can use the following command to solve the problem

Echo GRUB_CMDLINE_LINUX= "cgroup_enable=memory swapaccount=1" > > / etc/default/grub grub2-mkconfig-o / boot/grub2/grub.cfg > / dev/stdout 2 > & at this point, I believe you have a deeper understanding of "what are the methods of Docker optimization". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report