GithubHelp home page GithubHelp logo

blog's People

Contributors

codejuan avatar

Watchers

 avatar  avatar  avatar

blog's Issues

关于pinpoint

分为三个组件,agent,collector,UI

关键在于agent,是用来注入到JVM,hack相关函数,在修改消息体,加上trace ID和span ID

原理,用的java agent,在class load的时候,在关注的函数外围插入代码

golang,函数当参数的一个编译问题

现象

A依赖B,
type xxCallback func()
FB(xxCallback)
B里有一个函数FB的参数就是xxCallback

我的写法
f := func(){}
然后B.FB(f)
报错,说无法将f转换成xxCallback

原因是,虽然f的参数,返回值都和回调函数xxCallback一样,但是因为B没有导入A,所以不知道f的情况,这个时候就会编译不过?

OpenStack murano数据卷扩容流程

  1. nova stop
  2. nova volume-attachments
  3. nova volume-detach
  4. cinder extend
  5. nova volume-attach
  6. 调用murano agent执行resize2fs /dev/xxx,注意,好像对已经lvm的无效

grep备忘

  1. -r recursive
  2. w whole word
  3. n line number
  4. h without filename
  5. H with filename
  6. e pattern
  7. --include --exclude

namespace destroyed

When a IPC namespace is destroyed(i.e., When the last process that is a member of the namespace terminates), all IPC objects In the namespace are automatical destroyed.

When a network namespace is freed, its physical network devices are moved back to the initial network namespace. But how about the virtual network device?

用iso作为suse安装源

又一次被公司与世隔绝的环境恶心了一回。想装一个包,试了各种代理都不管用。
只好找到一个iso,mount出来,然后find rpm,拷贝到环境里,再进行安装。

大好时光浪费在这上面,唉

nova_docker inject ssh key权限问题

  • ssh过去提示bad owner
  • 在容器里看了下ssh authorize_key的owner是1001
  • 1001是宿主机user openstack
  • 因为openstack的nova-compute是用user openstack起的
  • 改inject key 把宿主机上instance/.ssh chown为root

问题

  • 以后启用了user namesapce之后,容器里的uID会根据offset变,而宿主机的root uid是0。
  • 后面改成docker cp?也不合适,因为在inject的时候,容器还没起来
  • 改成直接拷贝到device mapper?权限问题依然存在??

golang汇编

SB是stack basic register

FP是函数参数和返回值,高地址是参数

SP是函数栈,低地址是变量

systemd cgroup

利用systemd管理cgroup,通过system.slice建立一个独立的cgroup树

What is $* $@ $?¥* $# in Linux?

https://superuser.com/questions/247127/what-is-and-in-linux/247131

$#    Stores the number of command-line arguments that 
      were passed to the shell program.
$?    Stores the exit value of the last command that was 
      executed.
$0    Stores the first word of the entered command (the 
      name of the shell program).
$*    Stores all the arguments that were entered on the
      command line ($1 $2 ...).
"$@"  Stores all the arguments that were entered
      on the command line, individually quoted ("$1" "$2" ...).

客户端connect server报错enobufs

环境,5000虚拟机,

先strace,后看系统日志

原因是arp表太小,修改

/proc/sys/net/ipv4/neigh/default下面的gc_thresh1和2和3,改大一些

削足适履

在H厂,一纸行政命令,就要云化,但是在屁股决定脑袋的思维之下,云化变成了Docker化,逼着很多应用去削足适履,苦不堪言也就罢了,落地成果也不好。
A厂则不一样,云化的过程是尽量让业务不感知,看看T4和AliDocker的发展历程便可知。改造Docker,改造LXC以适配应用,而不是让应用来适配容器。
结果而论,A厂绝大部分应用都云化了,H厂很多容器项目都还在挣扎求存。

openstack上跑docker的日志问题

如果是私有云场景,可以把容器的log driver设置none,类似虚拟机的做法,用户的stdout等都不保存

公有云则可以参考阿里,写一个driver,打到专门的日志服务

ceilometer_docker

  1. pipeline.yaml,指标都在这
  2. setup.cfg,指标对应的pollster
  3. 通过pollster找到inspector
  4. 写docker的inspector
    • CPU,cgroup/CPU/docker/ID
    • memory,也在cgroup
    • disk,在cgroup的blkIO
    • net,/proc/pid/net/dev

Mac锁屏

土鳖终于用上了Mac。习惯了以前win+L一键锁屏,到了Mac之后,竟然没有快捷方式。
什么hot Corner还是麻烦,鼠标划来划去,还容易对不准。
Google一番,终于找到简单方法,用alfred, ALT+SPACE然后Lock

golang内存分配

获取本线程cache

判断对象大小,微对象,小对象,大对象的方法不同

微对象,从微对象freelist取,如果没有,则去central 来refill

小对象,与微对象类似

大对象,直接从heap取

抓包看了下https

client hello

Server hello

application data

全部被加密了,看不到url body head等等

crlf与lf的问题

格式变了,review的时候不方便

crlf的sh无法执行

解决办法

gitattribute

*.sh text eol=lf

*.bat text eol=crlf

阿里云日志服务的bug?

project似乎不是租户隔离的。
我创建project时提示project名称已存在,而我的project列表还是空的。

关于numa

docker create 的时候可以指定

内存离CPU近,可以提升性能

crlf与lf的问题

格式变了,review的时候不方便

crlf的sh无法执行

解决办法

gitattribute

*.sh text eol=lf

*.bat text eol=crlf

install docker

#14.04

apt-get update
apt-get install apt-transport-https ca-certificates
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" >> /etc/apt/sources.list.d/docker.list
apt-get update
apt-get purge lxc-docker
apt-cache policy docker-engine
apt-get install linux-image-extra-$(uname -r)
apt-get install linux-image-generic-lts-trusty
reboot

apt-get update
apt-get install docker-engine

汇报材料

讲清楚价值,以及能不能落地

技术细节,高层不关心

squash four commits into one

To squash four commits into one, do the following:

$ git rebase -i HEAD~4

In the text editor that comes up, replace the words "pick" with "squash" next to the commits you want to squash into the commit before it. Save and close the editor, and git will combine the "squash"'ed commits with the one before it. Git will then give you the opportunity to change your commit message to something like, "Issue #100: Fixed retweet bug."

Important: If you've already pushed commits to GitHub, and then squash them locally, you will have to force the push to your branch.

$ git push origin branch-name --force

Helpful hint: You can always edit your last commit message, before pushing, by using:

$ git commit --amend

如何监控容器的磁盘信息

  1. cgroup的blkIO可以获取到bytes和request
  2. 磁盘百分比可以用
    1. rootfs可以直接device map的df获取
    2. 其他卷则是通过配置文件找到宿主机的路径,然后也是df

阿里调度系统

最近看了一些帖子,提到了zeus和sigma,这是不是一个东西?

垃圾回收之三色标记

  1. 白,灰,黑
  2. 所有对象在白
  3. 根节点可达到灰
  4. 灰引用的都到灰,之前的灰到黑
  5. 清理全部白

user namespace

在搞lxc过程中研究了一下usernamespace,3.8开始支持,3.10能用(只能ext3 ext4),3.12之后就支持不错。
如果开了user namesapce,容器里的用户的uid就会加上一个偏移,降低和宿主机上的用户id相同的可能性。宿主机上用ls看容器用户创建的文件,uid都会是一串很大的数字。还有一个isolate特性,原理是不同容器会用到不同偏移段,容器间的uid也会不同。如果不用isolate,那么容器用的都是相同的偏移

关于之前未完成的容器项目

docker不过是新瓶装旧酒,最大的贡献是镜像,使得环境可以一致。
是否真的是一个进程一个容器呢?这个见仁见智吧,根据实际的业务场景,以及切换成本来看。我一致觉得,docker跑有状态应用不太合理。
根据官方口径,x万台物理机,xxx万个容器,业务场景更复杂,都能搞定,之前的项目没有理由搞不定。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.