Porting a Java Application for Go - Any Tips?

We want to rewrite the kodingen.com backend with Go , which is currently Java, working as a daemon using jsvc .

I never touched any C in my life, I just tried it in Java, so I don’t know if this is something that I should even start.

However, the task is quite simple

  • read shell commands from mysql database
  • and execute them in parallel
  • save each shell output to the database

what he. Therefore, these simple requirements give me hope that I can start using this wonderful language.

What would you suggest? C is even better?

+7
java c go
source share
4 answers

I like to travel a lot and contribute to the project. However, I think you should consider a few things about Go before deciding on them.

  • Go is still an unstable language. Its syntax, functions, and packages are subject to change. Make sure you are ready to keep up with this if you decide to use it.
  • Go garbage collection is still immature. Your memory usage should be better than 1.2 GB, but it probably won't get you closer to C levels.
  • There is no basic support for MySQL (or any other database). There are several unofficial MySQL package projects. The most recent updated GoMySQL and Go-MySQL-Client-Library . I do not know anything about how complete or stable they are.

As for the queue and execution in parallel, I think that something Go can do very well. You are probably using the exec package to execute and parallelize with goroutines.

+3
source share

I agree with @Chickencha

At this moment, I have no plans to update my project [1]: http://github.com/chbfiv/libmysqlgo "libmysqlgo". Contributions are welcome, but I'm too busy. I would recommend using more active mysql go projects.

+1
source share

From frequently asked questions:

The Go project was conceived to be simpler to write servers and other software Google uses internally, but the implementation is not yet sufficiently developed for large-scale production.

As I know, Go garbage collector and scheduler are not ready yet. And its compiler is not optimized enough, in any case, the C compiler has been improved for 20 years. If you want to use it on a production site, it is better to wait for Go to mature.

But this does not mean that Go is not the best language to learn. In fact, I enjoy using it to develop some useful utilities.

EDIT: Before moving on to another language, how about doing some experiments with the upcoming JDK 7. There are some improvements to garbage collection. You can check if memory management is better in your case.

+1
source share

I think with the recent addition of panic / recover, Go is starting to become a viable option for websites. I am launching some simple facebook applications using Go, but it disappoints that the whole application comes down to something like a key-key error or a null pointer exception. With panic / recovery it will be possible to manage failures.

About your requirements - this should be good for mysql and shell commands. But get ready to fix some libraries :)

+1
source share

All Articles