Solved

short string ID

Posted on 2010-09-13
13
388 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
  • 5
  • 4
  • 4
13 Comments
 
LVL 40

Expert Comment

by:gurvinder372
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:gurvinder372
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
 

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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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:gurvinder372
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:
gurvinder372 earned 200 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 200 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This video teaches viewers about errors in exception handling.

707 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now