RDBMS对Golang有影响 [英] RDBMS impact on Golang

查看:132
本文介绍了RDBMS对Golang有影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不打算在这个问题上大肆抨击我测试过的东西和数字捣鼓。我对实际最新的练习表演更感兴趣。

我已经阅读了大量文章,其中一些非常怀疑或者非常亲到一个图书馆。我目前正在使用 gorp 进行测试,但我不知道如何比较这种库对其他人的表现。



我知道 gorp 是一个额外的层,它试图将ORM添加到基本的SQL驱动程序/实现中,但是看到Go非常明确的代码,并且它非常接近它所做的一切都是骨骼。这与使用PHP / Python / JAVA不同,我也使用它,在这里你必须浏览无尽的复杂层次,才能真正看到包的本质。



<所以我的问题是如果任何人都可以分享(基准总是欢迎:))他们在这个问题上的经验和知识。



我不认为是NoSQL类型解决方案是我的项目的一个选项。我的所有项目总是强烈依赖业务逻辑和交织关系。我也想知道Postgres是否会赢得MySQL。有了Django(Python),我注意到使用Postgres可以显着提高性能,但是如果这是由于Postgres核心实现或者Django使用包装的原因,我从来没有在这方面找到证明。



小小更新

重读这个问题后,我注意到我错过了它的实际目标。实际上,我正在寻找最合适的SQL解决方案,它将减缓Golang本身的速度。我知道SQL是并发运行的,但是在将它作为Web服务运行时也涉及繁忙的流量。如果这会让我在性能上获得巨大收益,我不会再真正为此而烦恼。

需要使用ORM sqlx gorp < a>是很好的Go选项。就我个人而言,我有点老,我宁愿给一个给定类型 Foo ,我宁愿写一个 FooDB 实现 FooDS 接口的结构。您的应用程序中的所有内容都使用 FooDS 。 (DB = database,DS = datastore)

您的FooDB实现可以使用任意数量的底层技术MongoDB,LevelDB,SQL等,它可以随着您的应用程序更改而变化这个改变对你的其他应用程序是透明的(因为你的应用程序的其余部分使用 FooDS )。



我会默认使用数据库/ sql (Prepared statements等),而最成熟的Go SQL驱动程序是Julien Schmidt的MySQL驱动程序: https://github.com/go-sql-driver/mysql


I'm not going to make a big long rattle on this question about what I've tested and number crunching. I'm more interested in actual up-to-date practice performances.

I've read tons of articles already and some of them are pretty skeptical or either very pro to one library. I'm currently testing a bit with gorp, yet I have no clue how to compare the performances of such a library towards others.

I know gorp is an extra layer that tries to add ORM to the basic SQL driver/implementation, but seeing Go's extremely clear code and being it very close to the bone on everything it does. It's not like with PHP/Python/JAVA what I'm used too, where you have to navigate through endless layers of complexity to actually see what a package does in its essence.

So my question is if anyone can share (benchmarks are always welcome :) ) their experience and knowledge on this subject.

I don't think a NoSQL-type solution is an option for my projects. All my projects always strongly depend on business logic and intertwined relationships. I also wonder if Postgres will be a win over MySQL. With Django (Python) I noticed significant performance gain using Postgres, but I never found prove on that matter if it was due to the Postgres core implementation or just Django's way of using the wrapper.

Small update

After rereading the question I noticed I kind of missed the actual goal of it. I'm actually looking for the most suitable SQL solution that will least slow down Golang itself. I know the SQL runs concurrent, but also concerning heavy traffic when running it as a web service. I won't be really bothered to drop the ORM part again if that will get me major gain on performance.

解决方案

If you need to use an ORM sqlx or gorp are good Go options. Personally, I am a bit old school and I would rather for a given type Foo, I would rather write a FooDB struct that implements a FooDS interface. Everything in your app just uses FooDS. (DB = database, DS = datastore)

Your FooDB implementation could be using any number of underlying technologies MongoDB, LevelDB, SQL, etc and it can change as your app changes and this change is transparent to the rest of your app (since the rest of your app uses FooDS).

I would default to using database/sql (Prepared statements, etc) and the most mature Go SQL driver is Julien Schmidt's MySQL driver: https://github.com/go-sql-driver/mysql

这篇关于RDBMS对Golang有影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆