?
Solved

short string ID

Posted on 2010-09-13
13
Medium Priority
?
399 Views
Last Modified: 2012-05-10
please see this ...

Each request consists of a short string ID and a language key, limited to "EN", "FR", "ES", "DE" and "JP". Each response is a simple unicode string averaging 256 bytes in size, and there will be no more than 50,000 records for each language. All the records have already been translated and changes to the records will be rare.

I don't understand this text.

>>>>Each request consists of a short string ID and a language key, limited to "EN", "FR", "ES", "DE" and "JP".

What does this mean ?  does the request looks like this ...
param1=EN & param2=FR & param3=ES & param4=DE & param5=JP  ?

>>>>Each response is a simple unicode string averaging 256 bytes in size, and there will be no more than 50,000 records for each language

how does the response look like ? it just says " is a simple unicode string averaging 256 bytes in size"   .....Could you please tell , how the response will look like?



0
Comment
Question by:cofactor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 4
13 Comments
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 33660440
<<Each request consists of a short string ID and a language key, limited to "EN", "FR", "ES", "DE" and "JP>>
I think this means that incoming request will have a parameter which tells the server side script that in which language the response will be. Possibly you have a database in which records could be demarcated as per language (one of the column say 'language type'). So request will tell you as per which language (a select criteria) you want the records.

<<Each response is a simple unicode string averaging 256 bytes in size, and there will be no more than 50,000 records for each language. All the records have already been translated and changes to the records will be rare.>>
I think this is trying to say that you need to set the character encoding, and limit the number of records to 50 thousand.
http://www.javafaq.nu/java-example-code-235.html
Also see
http://forums.sun.com/thread.jspa?threadID=5336901
http://www.di.unipi.it/~ghelli/didattica/bdldoc/A97329_03/web.902/a95882/jspnls.htm
http://www.ibm.com/developerworks/java/library/j-jspapp/
0
 

Author Comment

by:cofactor
ID: 33660626
Thanks for your comment. I need some more help in your comment.
>>>>I think this is trying to say that you need to set the character encoding, and limit the number of records to 50 thousand.
I did not get this .
did you mean   select * from dbtable where languagetype='EN'  and  rownum > 0 AND rownum <= 50,000     ?  // this limit the number of records to 50 thousand.

>>>>I think this is trying to say that you need to set the character encoding
why ? what for ?
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 33660648
Limiting the number of records:
I think yes, thats what the statement you shared seems to suggest.

character encoding:
   why ? what for ?: so that you can display other language text on the webpage.
 
0
TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

 

Author Comment

by:cofactor
ID: 33660714
>>> so that you can display other language text on the webpage.
ok . fine . not a problem
but it also says  "All the records have already been translated and changes to the records will be rare"
translated ?  why translated ? we are using character encoding to display other language text on the webpage . no translation ...is not it ? Am I missing something?
0
 
LVL 10

Expert Comment

by:Hegemon
ID: 33660715
I think it is about designing an i18n solution for various message, where the request passes the key of the phrase to be looked up and the language. Something like:

Request: ..?text=THANKYOU&lang=FR
Responce: Au revoir

Moderate number of rarely modified  entries points to a caching approach, where the entries are preloaded and cached to minimise lookup time. In the extreme it is 4 maps, one for each language, containing 50K records each, the key being the 'short string ID' (the 'text' parameter in my example), the values being translated strings, up to 256 symbols.

The figures are apparently provide so that one can decide whether the whole thing can be cached or kept wholly in memory.
0
 
LVL 10

Expert Comment

by:Hegemon
ID: 33660757
Oops, the response should read "Merci" :)
0
 

Author Comment

by:cofactor
ID: 33660806
Hegemon,
good example. Here I take one HashMap example.
HashMap  for  languagetype = "FR"
THANKYOU =  Au revoir
Good Morning=bonjour
Good Night    =bonne nuit  
.................
.......................          
50,000 records
However the only restriction is the text is very short i.e 256 bytes only.  This way we could save some DB trip .We could fetch the records from in-memory.
0
 

Author Comment

by:cofactor
ID: 33660816
>>>"Merci" :)
well, ok . I posted few french words using google translator :)  
but is it the same you talking about . Please correct me if I'm misguided.   so, if the  text string is short then it will look for the in-memory ...but if the  text string is quite big then it'll look at the database .
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 33660819
If you want to save DB trip, you can pre-fetch the records from DB at server startup and store it in the hashmap or where ever you want.

Btw, can you tell me what is this snippet of text you asked us to explain?
0
 
LVL 10

Expert Comment

by:Hegemon
ID: 33660835
Well, your original question was about yourself not understanding the text of question and what the response could look like. I believe this is now answered.

As per the rest, can you post the original question in full ? I don't think there is a need to do database lookups, since you are given the AVERAGE size, thus you can estimate how much memory the whole dictionary will consume, without the need of knowing the size of individual entries.
0
 

Author Comment

by:cofactor
ID: 33661010
Here is the full context..

You are the architect of a project that will provide an external, low latency, scalable, and highly available service for handling string translations. Each request consists of a short string ID and a language key, limited to "EN", "FR", "ES", "DE" and "JP". Each response is a simple unicode string averaging 256 bytes in size, and there will be no more than 50,000 records for each language. All the records have already been translated and changes to the records will be rare.

What should you do to ensure that your service will scale and perform well as new clients are added?

A. Store all the records in an LDAP server and use JNDI to access them from the web tier
B. Deploy a standard 3-tier solution that is supported by a fast and reliable relational database
C. Deploy a single service on many servers in the web tier, each storing all the records in  memory
D. Store all of the records in a network attached file system so they can be served directly from the file system
I'm in doubtfull  between  B or C .  
I like B because its  3-tier solution + fast and reliable relational database
I like C because we can put the AVERAGE 256 bytes response  each of 50,000 records in memory  using a HashMap ....this will cached and will provide fast response. Also All the records have already been translated in the HashMap.
So, its now confusing which is the answer.
Answer is C
I'm not happy with C . it says "single service on many servers"  ...is it a cluster deployment ?
0
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 800 total points
ID: 33661051
In short, I think C is the best answer because rest of them will be slower anyways. Yes, its does appear to be a distributed application (when you talk of services) with cluster deployment (many servers).
For sake of complete solution, For all A, B, and C
1) every time you need to render a web-page, you have to do a JNDI lookup, Or a database call or read a file from file system sequentially and then filter the same
2) All of these require a network call and an input output operation
3) If you want to optimize all of them, you have to anyways cache the results, so why not cache them from the beginning.

0
 
LVL 10

Assisted Solution

by:Hegemon
Hegemon earned 800 total points
ID: 33661145
Ok, my 2c:

low latency - meaning the faster, the better, hence database is best avoided
scalable - as in the answer C: many servers. This is not a claster per se, just load balancing
and highly available - as above, but this needs a cluster
SERVICE for handling string translations - it is not a classic 3-tier application, it is a fast service.

Son in my view the answer is definitely C
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question