Skip to content
/ zimg Public
forked from buaazp/zimg

A lightweight and high performance image storage and processing system.

License

Notifications You must be signed in to change notification settings

cf-tao/zimg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#zimg#

zimg is a light image storage and processing system. It's written by C and it has high performance in image field. There is a benchmark test report with more infomation: Benchmark. zimg is designed for high concurrency image server. It supports many features for uploading and downloading images.

Homepage: zimg.buaa.us
Author: @招牌疯子
Contact me: [email protected]

Build Status Build Status

Versions:

  • 08/01/2014 - zimg 3.0.0 Release. High performence image process library.
  • 06/15/2014 - zimg 2.3.0 Release. Added broswer cache control.
  • 06/10/2014 - zimg 2.2.0 Release. Fixed memory leak in imagemagick.
  • 05/18/2014 - zimg 2.1.0 Release. Added IP access control module.
  • 04/26/2014 - zimg 2.0.0 Release. Supported distributed storage backends.
  • 03/10/2014 - zimg 1.1.0 Release. Supported SSDB storage.
  • 08/01/2013 - zimg 1.0.0 Release.

Dependence:

We stand on the shoulders of giants.

libevent: Provides a sophisticated framework for buffered network IO.
libmemcached: LibMemcached is designed to provide the greatest number of options to use Memcached.

[Optional] For Storage:

memcached: A distributed memory object caching system.
beansdb: Beansdb is a distributed key-value storage system designed for large scale online system, aiming for high avaliablility and easy management.
beanseye: Beanseye is proxy and monitor for beansdb, written in Go.
SSDB: SSDB is a high performace key-value(key-string, key-zset, key-hashmap) NoSQL database, an alternative to Redis.
twemproxy: Twemproxy is a fast and lightweight proxy for memcached and redis protocol.

Thanks to:

zimg contains these libraries. You needn't install them now.

webimg: A software suite to create, edit, compose, or convert bitmap images. Developed by SINA imgbed group.
libevhtp: A more flexible replacement for libevent's httpd API.
lua: Lua is a lightweight multi-paradigm programming language designed as a scripting language with extensible semantics as a primary goal.
hiredis: Hiredis is a minimalistic C client library for the Redis database.

Supplying:

Receive and storage users' upload images.
Transfer image through HTTP protocol.
Process resized and grayed image by request parameter.
Use memcached to improve performance.
Multi-thread support for multi-core processor server.
Use lua for conf and other functions.
Support beansdb/SSDB mode to save images into distributed storage backends.
IP access control for uploading and downloading images.
Broswer and client cache control.
Support high performence image process library webimg.

In Planning:

Performance optimization.
Security measures.

Documentation:

There is an architecture design document of zimg v1.0. It is written in Chinese.
Architecture Design of zimg
And this document is to introduce zimg v2.0.
Distributed Image Storage Server: zimg
The architecture of zimg's storage:

architecture_of_zimg_v2

Download:

The source code is licensed under a BSD-like License.
All versions on Github.

Build:

You should build dependences above and make sure the beansdb, beanseye or ssdb backend is working well.

git clone https://github.com/buaazp/zimg
cd zimg   
make  
cd bin  
./zimg conf/zimg.lua

More infomation of building zimg in guide book: Guide Book of zimg

Config:

--zimg server config

--server config
is_daemon=1
port=4869
thread_num=4
backlog_num=1024
max_keepalives=1
retry=3
system=io.popen("uname -s"):read("*l")

--header config
headers="Cache-Control:max-age=7776000"
etag=1

--access config
--support mask rules like "allow 10.1.121.138/24"
--note: remove rule can improve performance
download_rule="allow all"
upload_rule="allow 127.0.0.1;deny all"

--cache config
cache=1
mc_ip='127.0.0.1'
mc_port=11211

--log config
log=1
log_name='./log/zimg.log'

--htdoc config
root_path='./www/index.html'

--storage config
--zimg support 3 ways for storage images
mode=1

--mode[1]: local disk mode
img_path='./img'

--mode[2]: beansdb mode
beansdb_ip='127.0.0.1'
beansdb_port='7900'

--mode[3]: ssdb mode
ssdb_ip='127.0.0.1'
ssdb_port='8888'

Feedback:

If you have any question, please submit comment here or mention me on Weibo.
Technical issues are also welcomed to be submitted on GitHub.

About

A lightweight and high performance image storage and processing system.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 78.5%
  • CMake 9.2%
  • Lua 6.7%
  • PHP 2.0%
  • Go 1.2%
  • Makefile 1.0%
  • Other 1.4%