由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - system design question (转载)
相关主题
FMP supports UI thread in both Swing and SWTVBA question
app开发其实很难搞大家对sqlite评价如何?
请问一个问题1cassandra query speed求助
How to design a database model related to six degree of se (转载)Windows下大家都用什么SqlConsole啊?
《HTML5 & CSS3 (第1版)》英文文字版[PDF]question about using Hive parameter (转载)
change year format in Access by SQL query (转载)Querying JSON in Postgres
error of sql query in MS Access database (转载)deep learning做embeded system,业界动态或者公司
问一个如何建立一个rest web service ,其中有query string 功能。Interview questions about hash function
相关话题的讨论汇总
话题: database话题: now话题: records话题: memory话题: hash
进入Programming版参与讨论
1 (共1页)
w*s
发帖数: 7227
1
【 以下文字转载自 Linux 讨论区 】
发信人: wds (净洗前尘,从头再来), 信区: Linux
标 题: system design question
发信站: BBS 未名空间站 (Thu Oct 18 16:11:17 2012, 美东)
in my linux embedded board, i have 10000 person's records in the database.
in the web front end, you can view the 1st 100 person's records.
Now if you click "next page", it'll display record from 101 to 200.
To get the records from database, you pull all data into the memory and
return 100 records to caller. Certainly this uses plenty of memory.
Now if you and your wife are both browsing this webpage, worst case i need
the memory for twice of the whole database.
If you have 10 wives accessing this page, my code will be in trouble, as it
could need 10 times of memory.
Now
1. do i have to do cache in the backend (forget about web front end) for
database info ? can i just return "busy" if 10 ppl are opening database at
the same time ?
2. what's the common way to handle this ?
b***i
发帖数: 3043
2
我认为你可以根据配置,需求来优化。你的内存是几十k,还是几G?
比如,是否可以index?
还有,mem cache是否是singleton?一份就够了,对读来说。

【在 w*s 的大作中提到】
: 【 以下文字转载自 Linux 讨论区 】
: 发信人: wds (净洗前尘,从头再来), 信区: Linux
: 标 题: system design question
: 发信站: BBS 未名空间站 (Thu Oct 18 16:11:17 2012, 美东)
: in my linux embedded board, i have 10000 person's records in the database.
: in the web front end, you can view the 1st 100 person's records.
: Now if you click "next page", it'll display record from 101 to 200.
: To get the records from database, you pull all data into the memory and
: return 100 records to caller. Certainly this uses plenty of memory.
: Now if you and your wife are both browsing this webpage, worst case i need

d****n
发帖数: 1637
3
create a proxy before user can access the real database.(assuming all
operations are read only.)
in this proxy , use a hash or Tree data structure, so that, each time a user
asking his data, check the hash entries first.
if the 100 queries are not in the hash or partially not in the hash, start
getting them from the database, otherwise, if all the queries already in the
hash, bring them to the the front end.
the proxy need to be a high performance capable designed binary code and
keep itself in the system as a daemon thread.
you can add garbage cleaning or data expired control mechanism into it too.
And more...

【在 w*s 的大作中提到】
: 【 以下文字转载自 Linux 讨论区 】
: 发信人: wds (净洗前尘,从头再来), 信区: Linux
: 标 题: system design question
: 发信站: BBS 未名空间站 (Thu Oct 18 16:11:17 2012, 美东)
: in my linux embedded board, i have 10000 person's records in the database.
: in the web front end, you can view the 1st 100 person's records.
: Now if you click "next page", it'll display record from 101 to 200.
: To get the records from database, you pull all data into the memory and
: return 100 records to caller. Certainly this uses plenty of memory.
: Now if you and your wife are both browsing this webpage, worst case i need

g*****g
发帖数: 34805
4
Did I miss something? Why can't you do pagination in your DB query like
you did in your UI?

【在 w*s 的大作中提到】
: 【 以下文字转载自 Linux 讨论区 】
: 发信人: wds (净洗前尘,从头再来), 信区: Linux
: 标 题: system design question
: 发信站: BBS 未名空间站 (Thu Oct 18 16:11:17 2012, 美东)
: in my linux embedded board, i have 10000 person's records in the database.
: in the web front end, you can view the 1st 100 person's records.
: Now if you click "next page", it'll display record from 101 to 200.
: To get the records from database, you pull all data into the memory and
: return 100 records to caller. Certainly this uses plenty of memory.
: Now if you and your wife are both browsing this webpage, worst case i need

b*******s
发帖数: 5216
5
cache到用户端去

【在 w*s 的大作中提到】
: 【 以下文字转载自 Linux 讨论区 】
: 发信人: wds (净洗前尘,从头再来), 信区: Linux
: 标 题: system design question
: 发信站: BBS 未名空间站 (Thu Oct 18 16:11:17 2012, 美东)
: in my linux embedded board, i have 10000 person's records in the database.
: in the web front end, you can view the 1st 100 person's records.
: Now if you click "next page", it'll display record from 101 to 200.
: To get the records from database, you pull all data into the memory and
: return 100 records to caller. Certainly this uses plenty of memory.
: Now if you and your wife are both browsing this webpage, worst case i need

w*s
发帖数: 7227
6
this is a file based database, i cannot do query based on range ...
if i understand ur q ...

【在 g*****g 的大作中提到】
: Did I miss something? Why can't you do pagination in your DB query like
: you did in your UI?

g*****g
发帖数: 34805
7
I don't see why not as long as you have random access to the file. If you
just need some pre-known queries. Build index yourself. If not, you should
look at general purpose DB. Embedded devices usually have very few
concurrent users and the query requirement is not dynamic.

【在 w*s 的大作中提到】
: this is a file based database, i cannot do query based on range ...
: if i understand ur q ...

1 (共1页)
进入Programming版参与讨论
相关主题
Interview questions about hash function《HTML5 & CSS3 (第1版)》英文文字版[PDF]
ClassLoader breaks package var accesschange year format in Access by SQL query (转载)
google map 的问题error of sql query in MS Access database (转载)
STL map问一个如何建立一个rest web service ,其中有query string 功能。
FMP supports UI thread in both Swing and SWTVBA question
app开发其实很难搞大家对sqlite评价如何?
请问一个问题1cassandra query speed求助
How to design a database model related to six degree of se (转载)Windows下大家都用什么SqlConsole啊?
相关话题的讨论汇总
话题: database话题: now话题: records话题: memory话题: hash