Coder Social home page Coder Social logo

hhxsv5 / go-redis-memory-analysis Goto Github PK

View Code? Open in Web Editor NEW
140.0 9.0 26.0 440 KB

🔎 Analyzing memory of redis is to find the keys(prefix) which used a lot of memory, export the analysis result into csv file.

License: MIT License

Go 100.00%
redis memory analysis export-csvfile occupancy usage

go-redis-memory-analysis's People

Contributors

hhxsv5 avatar vericlongmore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-redis-memory-analysis's Issues

error panic: invalid RDB version number

redis-memory-analysis-linux-amd64 version v2.0.6

./redis-memory-analysis-linux-amd64 -rdb="./dump.rdb" -prefixes="#//:"

error info:
Starting analysis
panic: invalid RDB version number

goroutine 1 [running]:
github.com/hhxsv5/go-redis-memory-analysis.AnalysisRDB.Start(0xc42009a028, 0xc4200907e0, 0xc4200ae220, 0x2, 0x2)
/Users/dave/go/src/github.com/hhxsv5/go-redis-memory-analysis/analysis_rdb.go:183 +0x580
main.main()
/Users/dave/go/src/github.com/hhxsv5/go-redis-memory-analysis/examples/build.go:34 +0x332

my redis version is 4.0.10

can we use .rdb ?

i can not use the tool in production environment, but i can get .rdb file, can the tool support .rdb file ?

优化: 遍历所有db输出到一个文件和根据keyType类型统计key

1.统计的字段区分keyType,以string类型为例
AnalysisConnection的Reports 类型需要修改
type AnalysisConnection struct {
redis *storages.RedisClient
Reports map[string][]Report
}

var(
stringSortBySizeReports SortBySizeReports //String类型SortBySizeReports
)
reportMap := make(map[string]SortBySizeReports)
//循环代码
//赋值
reportMap["strType"] = stringSortBySizeReports
//赋值
analysis.Reports["strType"] = reportMap["strType"]

2.所有db文件输出到一个文件
template := fmt.Sprintf("%s%s%s%s", folder, string(os.PathSeparator), “demo”, ".json")
filename = template
fp, err := storages.NewFile(filename, os.O_WRONLY|os.O_CREATE|os.O_APPEND, os.ModePerm)

以上。

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.