Use clojure to develop game server [closed] - clojure

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I'm developing a server for a game. You kown in games,many data structures should be mutable. But Clojure's data structures is immutable. Is there some good idea to
do this? Should i use clojure for it?

Mutating data structures allows you to squeeze the last ounces of performance out of your code, but given that you're writing a server, network latency probably has a much greater impact than memory allocations. Clojure should be suitable, certainly as a starting point.
While Clojure's data structures are immutable, application state can be managed via atoms, refs, core.async loop state, and data pipelines. A Clojure application is hardly static just because its data structures are.
The biggest risk you face right now is figuring out what to build, and Clojure's live development model will accelerate the learning loop. You can redefine functions while the server is running and see their effects immediately.
I suggest you prototype your server in Clojure, then, if performance gains need to be made, profile the code. If necessary, you can introduce transients and volatiles, and port performance critical sections to Java.

Related

How Erlang is better than other language in doing concurrency? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I don't understand why erlang itself is great with concurrency
Is there anyway other language such as C# could be as great as erlang if we do some trick?
Or it is the very specific language feature of erlang that most language don't have?
Could we write C to be like erlang?
One Major property of Erlang is that it was built from the ground up to be a concurrent language. Erlang supports hundreds of thousands of lightweight processes in a single virtual machine. Because Erlang's processes are completely independent of OS processes they are very lightweight, with low overhead per-process. Thus when using Erlang for concurrent oriented programming you get alot of advantages out of the box.
Fast process creation/destruction
Ability to support millions of concurrent processes with largely unchanged characteristics.
Fast asynchronous message passing.
Copying message-passing semantics (share-nothing concurrency).
Process monitoring.
Selective message reception.
This Erlang style concurrency is not impossible to do in C, but it would be hard to do it. Read this blog for more information on Erlang style concurrency

What is the best way to call functions over a network? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm planning the network communications system for a program. The program is divided a client and a server class, but I might split them into separate programs if they get too big, and nothing else prevents it.
At the moment, all of the network communication is to call set and get functions on the server (of which their are about 500, and I expect to generate about 500-1,600 requests per second across eight clients in typical operations).
My current plan is to use a basic network API to send machine code inspired Opcodes to the server as a string, along with a few bytes of parameters, and have the server select the function and interpret the parameters using a massive switch statement.
However, with hundreds of possible function to call, this will get A) hard to read, and B)slow to implement. I'm also a bit concerned about the performance of large switch statements.
In light of that, could anyone confirm if this is the best way to implement function calls over a network, or tell me if there's a better way. I'd love a magic API that allows be to do something like x = callServerFunc(server, function, parameter1...) but my searches have not yet found such a library.
You can write your code from scratch. Feel free on how to do it.
Or you can use one of many ready mature technologies. Just google for CORBA, DCOM, XPCOM and so on. You can look at Remote call in common. Or consider existing web-based technologies with different data formats. This is just a starting point. This tehnologies are mature but heavyweight. You'll need some knowledge and practice to start with them.

Advantages of Service Oriented Architecutre [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I searched on Google, but didn't get straight answers that what are the advantages of Service Oriented Architecture?
Can someone please highlight some of the benefits of SOA?
The two most important (at least in a practical sense) are:
Small, manageable (i.e. maintainable) components.
Services can be distributed across different machines. This makes
the system highly scalable.
In other words: SOA is a good fit into the modern software development landscape with distributed teams and ever-changing requirements, be it functional or non-functional.
It gives great deal of re usability to your code and enormous power to the business as well.
Lets say you start creating an application for banking, now you need to create a mobile app for the same, and if that's not it you have to expose methods from your service to Master /Visa for transaction.
Now in the above scenario if application has been designed with SOA in mind, then lot of code is reused with added advantage of centralized deployment.

Approach to data-analysis [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm looking to write a reporting tool. The data resides in a ~6GB postgresql database. The application is an online store/catalog application that has items and orders. The stakeholders are requesting a feature that will allow them to search for an item and give a count of all those orders in the last 2 years.
Some rows contain quantities, and units of measure, which would require multiplication of quantity and UoM for each row.
It's also possible that other reporting functions will be necessary in the future.
I have not delved much into the data analysis aspect of programming. I enjoy Clojure, so I would be thrilled to find a solution that uses Clojure, but only if Clojure offers competitive tools for my needs.
Here are some options I'm considering:
merely SQL
Clojure
core.reducers
a clojure hadoop library
Hadoop
Can anyone shed some insight into these kinds of problems for me? Are there articles that you would recommend?
Hadoop is likely overkill for this project. It seems most likely that simply using Clojure-jdbc or Korma to read the data form the database and filter/reduce it in Clojure is likely to be fine. At work we routinely work with sequences of that size, though this depends on the expected response time. You may need to do some preprocessing and caching if instantaneous responses are expected.

File accessing -Java or C++ [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I have a lot of data kept in a file. Which one would be fastest for accessing some keywords from that file multiple times? Java or C++. Am I going to get some advantage in speed if I keep those data in a database like Sqlite compared to file operation?
Because C++ is a low-level language, while Java runs in a virtual machine, well-written C++ code will typically be faster than well-written Java code, especially for low-level operations (including file accesses). Java has significant overhead whenever it needs to perform an operation outside of its virtual machine.
For large amounts of data, a database will be much faster than direct file operation; it's exactly what a database is designed to do.
Use C++, because it compiles directly to native bytecode. While some JVMs also do that, Java can't be guaranteed to always run that way. A database language would be even better, like the Sqlite you mentioned, because the language is specifically optimized for database stuff.