Solved

short string ID

Posted on 2010-09-13
13
396 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: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
Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

 

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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

729 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