mirror of
https://github.com/jiangwenyuan/nuster.git
synced 2025-10-09 15:23:55 +02:00
Page:
nuster NoSQL
Pages
Basic Config
Getting Started
Home
Performance
Use nuster As HTTP Cache Server
Use nuster As HTTP.HTTPS Loader Balancer
Use nuster As RESTful NoSQL Cache Server
Use nuster As TCP Loader Balancer
Web cache server HTTP 2 performance benchmark: nuster vs nginx
Web cache server performance benchmark: nuster vs nginx vs varnish vs squid
Web cache server performance benchmark: nuster vs squid
nuster Cache
nuster NoSQL
No results
1
nuster NoSQL
Jiang Wenyuan edited this page 2018-08-11 16:51:24 +09:00
nuster can be used as a RESTful NoSQL cache server, using HTTP POST/GET/DELETE
to set/get/delete Key/Value object.
It can be used as an internal NoSQL cache sits between your application and database like Memcached or Redis as well as a user facing NoSQL cache that sits between end user and your application. It supports headers, cookies, so you can store per-user data to same endpoint.
- All features from HAProxy(HTTPS, HTTP/2, ACL, etc)
- Conditional cache
- Internal KV cache
- User facing RESTful cache
- Support any kind of data
- Support all programming languages as long as HTTP is supported
Setup
Build
See Getting Started
Config
global
nuster nosql on data-size 200m
frontend fe
bind *:8080
default_backend be
backend be
nuster nosql on
nuster rule r1 ttl 3600
Basic Operations
Set
curl -v -X POST -d value1 http://127.0.0.1:8080/key1
curl -v -X POST --data-binary @icon.jpg http://127.0.0.1:8080/imgs/icon.jpg
Get
curl -v http://127.0.0.1:8080/key1
Delete
curl -v -X DELETE http://127.0.0.1:8080/key1
Response
Check status code.
- 200 OK
- POST/GET: succeeds
- DELETE: always
- 400 Bad request
- empty value
- incorrect acl, rules, etc
- 404 Not Found
- POST: failed on all rule tests
- GET: not found
- 405 Method Not Allowed
- other methods
- 500 Internal Server Error
- any error occurs
- 507 Insufficient Storage
- exceeds max data-size
Per-user data
By using header or cookie in key, you can save per-user data to same endpoint.
nuster rule r1 key method.scheme.host.uri.header_userId if { path /mypoint }
nuster rule r2 key method.scheme.host.uri.cookie_sessionId if { path /mydata }
Set
curl -v -X POST -d "333" -H "userId: 1000" http://127.0.0.1:8080/mypoint
curl -v -X POST -d "555" -H "userId: 1001" http://127.0.0.1:8080/mypoint
curl -v -X POST -d "userA data" --cookie "sessionId: ijsf023xe" http://127.0.0.1:8080/mydata
curl -v -X POST -d "userB data" --cookie "sessionId: rosre329x" http://127.0.0.1:8080/mydata
Get
curl -v http://127.0.0.1:8080/mypoint
< 404 Not Found
curl -v -H "userId: 1000" http://127.0.0.1:8080/mypoint
< 200 OK
333
curl -v --cookie "sessionId: ijsf023xe" http://127.0.0.1:8080/mydata
< 200 OK
userA data
Clients
You can use any tools or libs which support HTTP: curl
, postman
, python requests
, go net/http
, etc.
- nuster wiki
- Documentation
- nuster Cache
- nuster NoSQL
- Performance Benchmark
- Web cache server HTTP/2: nuster vs nginx
- Web cache server: nuster vs nginx vs varnish
- Web cache server: nuster vs squid